php - htaccess site/category/name/page error -
i have url in site pagination, this:
http://localhost/category/food/1 category = call category.php food = 1 category, may have name 1 = page number
the problem is, maybe have page number, maybe not. if don't have page number want send page 1 php.
i tried:
rewriterule ^category/(.*) /category.php?categoria=$1 rewriterule ^category/(.*)/(.*) /category.php?categoria=$1&id=$1
to sum up, want access page in 2 different ways:
http://localhost/category/food - in case send 1 php or http://localhost/category/food/1
what wrong in code not working?
have rules this:
options -multiviews rewriteengine on rewriterule ^category/([\w-]+)/(\d+)/?$ category.php?categoria=$1&id=$2 [l,qsa,nc] rewriterule ^category/([\w-]+)/?$ category.php?categoria=$1&id=1 [l,qsa,nc]
avoid using .*
matches in regex.
Comments
Post a Comment