Forum Moderators: Robert Charlton & goodroi
I'm currently considering redirecting a few domains to a new branded one, and am wondering what the conventional wisdom on taking this action is currently. Is it advisable?
Also, what is the best method for redirecting an entire site, if I want to preserve file names and directory structure?
i.e. if I want
old-domain.com/index.html redirect to new-domain.com/index.htmlold-domain.com/widget1.html redirect to new-domain.com/widget1.html
old-domain.com/widget2.html redirect to new-domain.com/widget2.html
And so on for about 200 pages.
I don't think that writing an .htaccess file with 200+ lines is the way to go. Any suggestions?
It's still quite likely to have a ranking and traffic drop for a while - weeks or a few months - so do plan accordingly. Many problems people report are exaggerated by technical "wobbles" and fixes after a new site is indexed the first time. So thoroughly test everything you can before you go live and allow the spiders in. Remember the old carpenter's motto, "measure twice, cut once."
Now, how can you avoid writing out 200+ specific redirects for each page,especially since you are preserving the exact directory structure and file path. Since you mention using .htaccess, I assume you are on an Apache server. You can test the following, where you use $1 to match whatever file path was in the original request.:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.old-domain\.com [NC]
RewriteRule ^(.*)$ http://www.new-domain.com/$1 [R=301,L]
If I've made an error here, I hope someone more knowledgable will jump in.
Or, on a Windows IIS server, you would do this:
1. Set up www.old-domain.com and www.new-domain.com as
websites in Internet Services Manager. Then enter into the
Properties for www.old-domain.com
2. In the Home Directory tab, change the option button "When
connecting to this resource the content should come from" to
"A redirection to a URL".
3. Specify the URL as http://www.new-domain.com$S$Q
4. Check the checkbox that says "A permanent redirection for
this resource."
Note that in Step #4 variables are needed
$S will preserve the file path, and $Q will preserve any query string
In either case, Apache or Windows, make sure you have all your canonical redirects in place - and don't use any redirect "chains". So make sure that old-domain.com redirects to www.new-domain.com in just one step, not two.
---
All that said, to would be good to hear from anyone who recently moved to a new domain and redirected urls from the old domain, either all to the new domain root or page by page.
I'm wondering what this statement means, exactly:
In either case, Apache or Windows, make sure you have all your canonical redirects in place - and don't use any redirect "chains". So make sure that old-domain.com redirects to www.new-domain.com in just one step, not two.
What are redirect chains and canonical redirects?
"Canonical problem" is Google's terminology for situations where more than one url gives you the same page. For example, "with-www" and "no-www" urls that resolve to the same content create a canonical problem. These situations do not usually bring your site a true penalty, but they can diffuse your PageRan,making it much harder to rank.
Our Hot Topics area [webmasterworld.com], which is always pinned to the top of this forum's index page, has several reference threads about different kinds of duplicate url problems.