How to redirect URLs to the correct website

Posted on 2010-01-08
Medium Priority
Last Modified: 2012-05-08

I was wondering how URL redirection is handled.

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

Question by:Methodman85
LVL 31

Assisted Solution

by:James Murrell
James Murrell earned 400 total points
ID: 26214466
simple explation can be found at http://www.webconfs.com/how-to-redirect-a-webpage.php with examples for iis

Author Comment

ID: 26214583
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 www.website.com
it would redirect to the www site?
LVL 31

Expert Comment

by:James Murrell
ID: 26214748
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

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.


Author Comment

ID: 26215142
It didn't work. I just want the www name to show in the url bar after the user types website.com without the www infront of it.
When I did this redirection website.com went to a Bing search.
and www.website.com 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?
LVL 31

Expert Comment

by:James Murrell
ID: 26261356
who is your domain name with?
LVL 13

Accepted Solution

Springy555 earned 1400 total points
ID: 26272759
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 website.com.  A test to see if this has been done is to ping www.website.com.  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 website.com, which will have a host header of website.com only.  A second website for www.website.com.  This website will hold all your web content.  You must make sure it has a host header of www.website.com 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.com website.  This can be done numerous ways, but the quickest is:

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

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

But remember for this to work, you need to have a WWW DNS 'A' record setup, pointing to the same IP as website.com.  Or a DNS CNAME record for WWW, resolving to website.com.
LVL 51

Assisted Solution

ahoffmann earned 200 total points
ID: 26349823
> 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)

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question