I've switched domains and would like to redirect all pages like olddomain.com/somepage.html to newdomain.com/somepage.html - while preserving the same url structure. Could you show the htaccess code for it? thanks!
I haven't used this, just have it on file in case I need it for the same scenario. It's rather simplified, but it should redirect any requests on the old domain to the same location on the new domain. Redirect 301 (.*)$ http://www.newdomain.com/$1 Code (markup):
Nothing is going to loop, but if you look for a SEO friendly (which really means very little today) way of doing the same thing, do this: RewriteEngine on RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L] Code (markup): The rule above redirects each page on an old domain to the same pages on a new domain.
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !newdomain.com$ [NC] RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301] Code (markup):