I have the following rewrite rule in my .htaccess file:
RewriteRule ^([^/]+)/([^/]+)/(tab:([^/]+)/?)?(scope:([^/]+)/?)?(sort:([^/]+)/?)?(p:\d+)/?)?$ web/results.php?view=$1&q=$2&tab=$4&searchscope=$6&sortBy=$8&page=$10 [NC,QSA,L]
It seems to work great when testing on some of the online regex testers that I have found. However on this tester (which seems to be a better tester and represents exactly what I am seeing when I try to apply this rule I am seeing some strange things. http://civilolydnad.se/projects/rewriterule/
Lets way I apply it to this url:
view1/harry+potter/tab:search/scope:blah/sort:cdate
What I get is web/results.php?view=view1&q=harry+potter&tab=tab:search/&scope=scope:blah/&sort=sort:cdate&p=0
What is strange to me is that I should be getting tab=search
not tab=tab:search/
. And the other parameters are similar.
The matching regex group 4 contains search
, but if I don't use group 3 ($3) somewhere in the query, I don't get access to $4.
I must be doing something wrong. Any suggestions?