I have a rule that will take a this url and handle it properly.
RewriteRule ^category/([a-zA-Z0-9-z\-]+)/([a-zA-Z0-9-z\-]+)$ category.php?page=category&subPage=$1&pitem=$2
mysite.com/category/phones/htc-desire
The problem is if the url ends up being
mysite.com/category/phones/
the rule will just look for a page that does not exist.
What I need to do is work in “any page that is not empty” into the rule.
Any advice?
This should work:
” + ” quantifier at the end of your regex group means “1 or more”, while ” * ” makes it entirely optional.