mercredi 25 juin 2014

htaccess urlrewriting error


Vote count:

0




This is my htaccess file:



Options +FollowSymLinks
RewriteEngine on

RewriteRule ^category/(.*)/$ categories.php?cat_name=$1
RewriteRule ^category/(.*)$ categories.php?cat_name=$1
RewriteRule ^category/(.*)/([0-9]*)/$ categories.php?cat_name=$1&page=$2
RewriteRule ^category/(.*)/([0-9]*)$ categories.php?cat_name=$1&page=$2


When a users open this page mywebsite.com/cars/ it opens the first page of the category cars which is corrent, but when they write mywebsite.co/cars/2 the code $_GET['cat_name'] brings cars/2 which is wrong because the cat name is cars and 2 is the page number.


How to fix this?


Thanks



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire