Forum Moderators: open
What the client currently has is two versions of every URL indexed in the search engines, with and without the www. The search engines are quite tangled up on this and it needs to be straightened out.
So how can we make every url request that has no www permanently redirect to the equivalent url that includes the www. We've tried quite a few approaches, but somehow we always end up redirecting every URL just to the index page of the www version.
We need:
example.com/dir/page.html --> www.example.com/dir/page.html
We currently get:
example.com/dir/page.html --> www.example.com
Where might we be going wrong?
But now I have egg on my face. While I was checking on our various IIS changes, I was using a new browser and I had not set its preferences to look at the server each time. So what I thought was not working properly was really working just fine - if I actually went to the server. But I was seeing the browser's cache.
In case someone who is working with the same issue finds this thread, here is what we ended up doing that worked.
1. In Internet Services Manager we created a web site for
example.com -- without the 'www'2. We pointed example.com to the same content
directory that we already use for www.example.com3. Next we opened example.com in Internet Services
manager and went to its properties4. On the Properties screen we chose the Home Directory tab
5. We changed "When connecting to this resource the content
should come from" to this option: "A redirection to a URL"6. We entered the full URL in the textbox -
http://www.example.com7. Finally we checked the checkbox that says:
"A permanent redirection for this resource."
That's what it took and now the redirects are all working just fine. And as with many things in technology, now that I know it, it just seems obvious.
But seeing doubled versions of our urls in Google had me freaked out a bit - espcially because we were losing listings and seeing many PR0 pages. The site had just migrated from Apache, and I'm glad to know how to do this now on IIS.
During my search, I found many pages at Microsoft.com that are helping to clean up after the migration. In particular, these two links proved very helpful:
Migrating .Htaccess Data to IIS [support.microsoft.com]
Migrate Apache Settings and Configure IIS [support.microsoft.com]