Wow, it seems this forum is full of mod_rewrite questions - sorry to add yet another ;-) I've got a load of URLs with query strings which I need to redirect to pages with completely different names (i.e. the name is not directly related to the query string). For example: /modules.php?name=whatever&op=load&file=blah would need to redirect to: /someotherpage123.html I have ~2000 similar URLs, all of which need to be redirected to a different page. The whole filename and query string is needed to determine which page to redirect to. I've spent hours Googling and trying different things, but just can't figure it out. I would have thought it would be simple, as no regular expressions should be needed... Thanks in advance for any help!
Is there anything in the query string that would relate/match your static urls? If so then you have a good chance of writing a rule to redirect fairly easily.
Can RewriteMap be used in .htaccess files? I'm getting 'RewriteMap not allowed here' errors (AllowOverride is set to All). I don't have access to the configuration file of the server I'm working on, so I have to use .htaccess...
According to the docs I should have read eariler, RewriteMap can only be used in the server config or virtual host configs One thing I was trying earlier was: RewriteCond %{QUERY_STRING} name=whatever&op=load&file=blah RewriteRule ^someotherpage123.html [R=301,L] Might some variation of that work? It didn't when I tried, but I know a misplaced '^' or '/' can make all the difference...
try RewriteCond %{QUERY_STRING} name=whatever&op=load&file=blah RewriteRule ^modules.php$ someotherpage123.html [R=301,L] Code (markup): I think that should do it.