I’m trying to make this:
www.amazingjokes.com/cache/search.php?term=programming
to go to this:
wwww.amazingjokes.com/popular/programming
But I can not get it to work properly. I tried stuff like
RewriteRule ^cache/search.php?term=(.*)$ /popular/$1 [R=301,L]
but to no avail.
RewriteRule doesn’t receive the query string, what it’s actually receiving is just the path to the file. So while you’re going to
/cache/search.php?term=programming, what it’s actually receiving is just/cache/search.php.You can, however, use a RewriteCond on the
%{QUERY_STRING}variable: