I have a bunch of non-existent urls that need to be redirected to new ones, though they are not working... mod_rewrite does work and is enabled, I'm wondering if the redirect URL has to actually exist in order for a redirect ot work.

Here is what I have:

Redirect 301 /cgi-bin/commerce.cgi?display=action&emptyoverride=yes&template=Assets/XHTML/Advantage.html http://domain.com/the-bag-to-nature-advantage.html

UPDATE this is the request that comes in [indexed in google!] http://domain.com//cgi-bin/commerce.cgi?display=action&emptyoverride=yes&template=Assets/XHTML/Advantage.html

this is where it needs to go: http://domain.com/the-bag-to-nature-advantage.html

link|improve this question

58% accept rate
this is present in your htaccess file? – Frank Nov 10 '11 at 17:06
3  
Redirect is a part of mod_alias, not mod_rewrite. And I'm pretty sure it won't work on your query params.. – Shane Madden Nov 10 '11 at 17:07
Please could you explain precisely what you want to do (ie examples of what comes in and what should come out)? – Olivier Pons Nov 10 '11 at 21:09
@ShaneMadden True, but I'd add that Mod_Rewrite will work on the Query params. – Chris S Nov 11 '11 at 17:04
feedback

1 Answer

To use mod_rewrite:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^display=action&emptyoverride=yes&template=Assets/XHTML/Advantage\.html$ [NC]
RewriteRule ^/cgi-bin/commerce\.cgi$ http://domain.com/the-bag-to-nature-advantage.html [R=301]

Note that this is for if it's in your VirtualHost context; strip the leading slash on the RewriteRule if you put it in a Directory or htaccess context.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.