Forum Moderators: phranque
[Tue Aug 5 11:40:12 2008] [alert] [client 68.173.196.176] /home/pokeuniv/public_html/example.net/stuff/audentio/.htaccess: RewriteRule: cannot compile regular expression '^search/([A-Za-z-0-9-]+)$'\n
My RewriteRule is as follow:
#Searching
RewriteRule ^search$ search/ [R]
RewriteRule ^search/$ search.php
RewriteRule ^search/([A-Za-z-0-9-]+)$ search/$1/ [R]
RewriteRule ^search/([A-Za-z-0-9-]+)/$ search.php?do=$1
If anybody could help me out with this, I'd appreciate it.
[edited by: jdMorgan at 9:36 pm (utc) on Aug. 5, 2008]
[edit reason] example.net [/edit]
You have an un-needed (and illegal) hyphen between "z" and "0" in the grouped character subpatterns of your last two rules, and the "9" is then followed by another un-escaped (and therefore potentially-illegal) hyphen.
I also note that you are missing the [L] flag from all rules, and that you're using a 302-Found redirect (by default).
I strongly suggest that you use [L] on all rules unless the output of a rule needs to be further processed by a subsequent rule, and that you use [R=301] and a full canonical URL to generate permanent redirects. Example:
RewriteRule ^search/([b][A-Za-z0-9\-][/b]+)$ [b]http://www.example.com/[/b]search/$1/ [[b]R=301,L[/b]]