Forum Moderators: phranque
RewriteEngine on
RewriteCond %{HTTP_HOST} ^oldexample1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.oldexample1\.com$
RewriteRule ^(.*)$ "http\:\/\/www\.newexample\.com\/$1" [R=301,L]
RewriteRule ^something\.html http://www.newexample.com/something-or-something-new.html [R=301,L,NC]
RewriteRule ^some-sub/ http://www.newexample.com/some-or-new-sub/ [R=301,L,NC] I noticed G showing links form old non-existing sites to the new one.
...if needed, redirect specific requests to new/consolidated pages
RewriteRule ^(.*)$ "http\:\/\/www\.newexample\.com\/$1" [R=301,L] RewriteRule ^(.*)$ http://www.newexample.com/$1 [R=301,L]
I don't understand this part
Via this intermediate link:
RewriteCond %{HTTP_HOST} ^oldexample1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.oldexample1\.com$
can always be simplified to RewriteCond %{HTTP_HOST} oldexample1\.com
with no anchors. The only time you can't do this is in the very rare case where you have two domains living on the same server and one name is contained within the other, like "example.com" and "old-example.com", or "example.co" and "example.com"