Hi, I wanted to rewrite one of my url, from: mysite.com/results.php?category=12 to mysite.com/chulucanas-pottery which I did successfully with the following code : RewriteRule ^chulucanas-pottery$ results.php?category=12 but now I want to redirect all trafic that goes to mysite.com/results.php?category=12 to go to mysite.com/chulucanas-potttery how can I do this , I try : RewriteCond %{QUERY_STRING} category=12 RewriteRule ^results\.php$ chulucanas-pottery? [R=301,L] but it did not work, any suggestions? Thanks
Something like this should work fine. RewriteEngine On RewriteCond %{QUERY_STRING} ^category=12$ RewriteRule ^results\.php$ chulucanas-pottery [R=301,L]
When you say "it doesn't work" what actually happens ? Does it just display the page without redirecting ? Does it redirect in an infinite loop ? Does it display a 500 error ?
Have you checked into the idea of setting up a rewrite log to see what's happening? RewriteLogLevel 3 RewriteLog /usr/local/apache/domlogs/yourdomain.com-rewrite I've not tried it but I believe you change change the rewrite log level up to 9 for full information.
Well first, thanks for the replies. I tried what morten suggested, but with a little variation at the end of the third line right before "[R=301,L]" (the question mark), as follows : RewriteEngine On RewriteCond %{QUERY_STRING} ^category=12$ RewriteRule ^results\.php$ chulucanas-pottery? [R=301,L] RewriteRule ^chulucanas-pottery$ results.php?category=12 with this code it rewrites the url and also redirects it but the page does not load it says: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. any thoughts Thanks