How to redirect URLs to the correct website


I was wondering how URL redirection is handled.

Say for instance I type in into my webrowser. How is it automatically redirected to

Who is Participating?
To get this working you need to do the following:

Ensure you have a DNS record setup named WWW.  This needs to point to the same IP address as  A test to see if this has been done is to ping  It should at least resolve to an IP address.  Whoever manages your DNS should be able to create this record for you.

Next, in IIS you need to have 2 websites.  One website for, which will have a host header of only.  A second website for  This website will hold all your web content.  You must make sure it has a host header of only.  You can modify/add the host header by right clicking on your website in IIS manager console, selecting properties.  Click the advanced button on the website tab, and its there you can add the host headers.

Now you need to setup the redirect for the website.  This can be done numerous ways, but the quickest is:

- Right click, select the home directory tab.  Select 'A redirection to another URL', and type in

What will happen is that someone will type in their browser.  The request will hit your webserver.  It will match the host header for website.  It will see the redirect you set up to  It will send that back to the users browser, which will then try and load  Again this will match the host header for and load that website.  Th URL in the users browser would also have changed from to

But remember for this to work, you need to have a WWW DNS 'A' record setup, pointing to the same IP as  Or a DNS CNAME record for WWW, resolving to
James MurrellProduct SpecialistCommented:
simple explation can be found at with examples for iis
Methodman85Author Commented:
So are you saying that if I right click on my websites index.html file, select A redirection to a URL, and under local path type
it would redirect to the www site?
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

James MurrellProduct SpecialistCommented:
Yes IIS Redirect In internet services manager, right click on the file or folder you wish to redirect Select the radio titled "a redirection to a URL". Enter the redirection page Check "The exact url entered above" and the "A permanent redirection for this resource" Click on 'Apply'
as always test in non production machines if unsure

Methodman85Author Commented:
It didn't work. I just want the www name to show in the url bar after the user types without the www infront of it.
When I did this redirection went to a Bing search.
and didn't even load.
These aren't seperate sites, I'm not trying to redirect to another site, it's the same site, I just want the www infront.
Did I do something wrong, am I suppose to redirect the index.html file, or the entire website?
James MurrellProduct SpecialistCommented:
who is your domain name with?
> How is it automatically redirected to ..
either the server sends a 30x redirect status with the new location
or the browser cannot resolve the given DNS name and autocompletes it (see yur browser properties)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.