I have just moved a domain and would like to know how to redirect everything from the old domain to the new domain. With the following code it redirects all pages to the new domain RewriteCond %{HTTP_HOST} ^.*oldwebsite\.com$ [NC] RewriteRule ^(.*)$ http://www.newwebsite.net/$1 [R=301,L] Code (markup): so oldwebsite.com -> newwebsite.net The problem is that oldwebsite.com/folder/file1.html is also -> newwebsite.net What is the code for having oldwebsite.com/folder/file1.html automaticly redirecting to newwebsite.net/folder/file1.html
I was thinking too complex. The code should be Redirect 301 / http://www.newwebsite.net/ Code (markup):
RewriteCond %{HTTP_HOST} ^.*oldwebsite\.com$ [NC] RewriteRule ^(.*)$ http://www.newwebsite.net/$1 [R=301,L] that seems ok on the surface. what is/or isn't it doing correctly ?
Because it forwards everything to the new domain, not the pages within the domain. So olddomain.com/link1/page1.html is forwarded to newdomain.com instead of newdomain.com/link1/page1.html