Should this 301 be working? Is this a code error or 1and1 error?

AddType x-mapp-php5 .php #[COLOR="#FF0000"]Required for 1and1 server which is php4  by default[/COLOR]

Options +FollowSymlinks
RewriteEngine On

Redirect 301 /index.php?route=product/product&product_id=51

For posting here, I have changed the new domain name, but the rest of it is the code copied from the htaccess I wrote.

If I code it domain-to-domain, like this:

RewriteRule (.*)$1 [R=301,L]

the 301 works, but the page-to-page 301 is not working.


First, 1&1 is known to be a horrible host.

Second, I don’t believe Redirect can access the query string as your Redirect statement is attempting - you need mod_rewrite for that.

Third, (.*) will match EVERYTHING and redirect to It retains the {REQUEST_URI} variable as well as the {QUERY_STRING} so, if the scripts (including database and CMS configuration) are identical, it should work exactly the same at



Thanks DK

I have found a solution to the query string problem but I’m still struggling with an instruction to redirect the remaining pages to the a single page.

For the query string problem

RewriteCond %{QUERY_STRING} ^string-after-the-question-mark-of-old-url$
RewriteRule ^index.php$ [L,R=301]

I will write a variation of that for several different pages. But I also need to redirect the rest of the site to the index page of the new site.

If I try the following:

Redirect 301 /

it keeps everything after the forward slash in the redirect, so becomes

Perhaps this is because of the query string problem, I don’t know. All the pages have the question mark. If so perhaps I need code that would fulfil this pseudo code:

RewriteCond %{QUERY_STRING} ^[B][COLOR="#FF0000"](Wild card)[/COLOR][/B]$
RewriteRule ^index.php$ [L,R=301]

(.*) used as wild card works




QSA flag is what you need - it retains any query string when you’re creating a new query string, otherwise, it’ll be sent along anyway. In short, ARGH! You don’t want/need (.*)!



Hi Dk

The new site has clean URLs. The question mark at the end of the destination URL is possibly just wrong and misleading but the code above is sending any URL with a query sting to the home page of the new destination site.


Okay, I must have misread what you were trying to do:

  1. To retain a query string, do nothing.

  2. To retain a query string and add another term, add the term and use the [QSA] flag.

  3. To replace a query string, simply add the replacement query string.

  4. To KILL a query string, add the ? to the redirection (it will NOT be displayed, it will merely tell Apache to ignore the existing query string).