dimanche 23 avril 2017

PHP url rewriting

I have this application in PHP which generates the following link

http://localhost/april/24_april/24_april/video.php?cat_id=14&category=C-And-C++

But with the help of .htaccess file i was able to trim down the URL to

http://localhost/april/24_april/24_april/video-library/2/Programming-Language. Now the issue is every time i run the application it firsts loads the messy URL , and when i edit it accordingly then the page also gets loaded. So is there any way that the application could directly load the clean URL, rather than the messy URL.

PS: this is my .htaccess file

RewriteEngine On
RewriteRule ^video-library/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ /var/www/html/april/24_april/24_april/video.php?cat_id=$1&category=$2
RewriteRule ^video-library/([A-Za-z0-9-]+)/?$ /var/www/html/april/24_april/24_april/search_results.php?cat_id=$1

PS:Also my CSS and JS does not get loaded in the page from the clean URL.




Aucun commentaire:

Enregistrer un commentaire