I have two websites x and y. y is my new domain and I want everything from x to redirect to y. For instance, if a user types in www.x.com/test.html then I want to redirect to www.y.com/test.html. Everything is the same, except for the domain name. so no matter what the user types in, I want to just replace the domain part to my new domain. Any ideas on this? Also, if a page doesn't exist, then how can I redirect to my home page?
On the old domain, you can create a .htaccess file in domain.com/.htaccess containing: RewriteEngine On RewriteRule . http://www.newdomain.com%{REQUEST_URI} [R=301,L] Code (markup): That matches every request on that domain, then does a 301 redirect to the new domain with the requested uri.
Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
So how could I do this if I am redirecting to a new site that has a different directory structure? i.e. http://www.olddomain.com/old/old to http://www.newdomain.com/new/new Thanks!