na************@msn.com wrote:
ok. i give up. need help :)
here's the rule:
RewriteRule ^test/(.+)/(.*)$ /index.php$2
if i request: http://localhost/test/keyword/?show=files it properly
redirects me.
NOW, if i change the rule to: RewriteRule ^test/(.+)/(.*)$
/index.php$2&key=$1
it stops working.
i figured out that if i remove ? from $show=files and change the rule
to redirect to /index.php?$2, then i can use &key=$1. but i want to
figure out how to redirect the ?show=files request AND at the end add
&key=$1
RewriteRule does not match against the query string in mod_rewrite. To
match against that you will need to use
RewriteCond %{QUERY_STRING} pattern
RewriteRule works against the REQUEST_URI..
Therefore, as per your examples above:
RewriteRule ^test/(.+)/(.*)$ /index.php$2&key=$1
Consider this URI:
/test/dir1/dir2/?var=val
The result would be:
/index.phpdir2/&dir1
If you want to keep the original query string with your request, add the
[QSA] flag at the end of the RewriteRule statement (Query String Append)..
Using this with the same URI above...
RewriteRule ^test/([^/]+)/([^/]+)$ index.php?$2&key=$1 [QSA]
/index.php?dir2&key=dir1&var=val
HTH
--
Justin Koivisto, ZCE -
ju****@koivi.com http://koivi.com