Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I want to rewrite a domain to another domain and add get parameters using Apache's mod_rewrite, redirect or similar.

So:

www.domain.com -> www.otherdomain.com/?param1=value1&param2=value2

Can this be done?

I've been testing with the following without success:

Redirect www.domain.com  http://www.otherdomain.com?param1=value1&param2=value2
share|improve this question

1 Answer 1

There seems to be enough missing from your question I am not sure I am answering it the way you need it to be. For example what parameters and RewriteCond are you using? You can always look at the various Apache .htaccess documentation like this one http://httpd.apache.org/docs/current/mod/mod_rewrite.html but that may add confusion if you are new to this stuff.

To answer your question simply:

RewriteRule ^(.*)$ http://www.newsite.com/$1 [R=301,L]

This should take the parameters that were used to access the old site by the user and pass them on to the new site.

If this is not what you were thinking, let us know.

share|improve this answer

Your Answer

 
discard

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