[thelist] Mod rewrite question

Chrome admin at chrome.me.uk
Fri Jun 13 08:24:24 CDT 2008

> What I've got now is
> RewriteRule ^category/([a-zA-Z0-9_]+)/$ browse.php?cat=$1 [QSA,L]
> Which allows me to link to my category pages like so:
> www.domain.com/category/CATEGORYNAME/
> But now I'd like to add in the page numbers, like:
> www.domain.com/category/CATEGORYNAME/1/
> www.domain.com/category/CATEGORYNAME/2/
> Etc...
> This sort of works...
> RewriteRule ^category/([a-zA-Z0-9_]+)/(page[0-9*]/)$
> browse.php?cat=$1&pageNum_productinfo=$2 [QSA,L]

I don't know much about mod_rewrite but I believe the multiple digit problem
is caused by [0-9*] which should be [0-9]*

Might bring you a step closer

> But, if there's no page number, then I get a 404. And, if the page
> number is more than single digit, I get a 404.
> Also, is it possible to make it work if the last / is missing in the
> URI?

Try this (page[0-9]*/?)?$

I don't know if the ? works the same as with Perl compatible regexes in

Mental note: learn more about mod_rewrite

> tia,
> -jeremy


More information about the thelist mailing list