Forum Moderators: open

Message Too Old, No Replies

Redirecting every url to the "www" version in IIS

Client is migrating from Apache to IIS and I'm feeling lost

         

tedster

5:56 am on Jul 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've read at least 40 threads here about 301 redirects on IIS, but I'm still stumped (probably because this is my first excursion into IIS territory)

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?

makeupalley

10:57 am on Jul 24, 2004 (gmt 0)

10+ Year Member



Here is what I think you need to do:

Simply change the host header for your web site to
have entries for both
www.domain.com and domain.com
after you've done that you will not need two copies of the site.

hope this helps,

Elky

tedster

6:59 pm on Jul 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the suggestion - yes, the host header does make both urls resolve to the correct (and single) content resource. But it doesn't redirect the url so that search engines only have one version in their index.

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.com

3. Next we opened example.com in Internet Services
manager and went to its properties

4. 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.com

7. 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]