Suppose I have URL's with query string, ie:
/DesignPatterns
Using mod_rewrite, how can I redirect them to:
/index.php?book=DesignPatterns
is it correct the following?
RewriteCond %{QUERY_STRING} (\w+)
RewriteRule ^index.php?book=%1? [L,R=301]
PS: The original question: How can I match query string variables with mod_rewrite? (Feb 12 '10, Patrick McElhaney, I am asking following his permission)
The complete solution would be
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+) index.php?search=$1 [L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With