Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

UPDATE this is the request that comes in [indexed in google!]

this is where it needs to go:

share|improve this question
this is present in your htaccess file? – Farhan Nov 10 '11 at 17:06
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

To use mod_rewrite:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^display=action&emptyoverride=yes&template=Assets/XHTML/Advantage\.html$ [NC]
RewriteRule ^/cgi-bin/commerce\.cgi$ [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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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