Reputation: 1911
My goal is to redirect an entire domain to another. Every URL of the old domain shall redirect to the root URL of the new domain.
To achieve this I'am doing:
redirect 301 / http://www.google.de/
Problem is that when I test it on http://localhost/randomPath
then it redirects to http://www.google.de/randomPath
, but not to the root URL of google.de.
Does anyone know how to solve this?
Upvotes: 2
Views: 41
Reputation: 785008
Use mod_rewrite
for finer control on rules like matching Host name etc.:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule ^ http://www.google.de/? [L,R]
?
in the end of target URI will strip off any existing query string.
Upvotes: 2