Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Over time, I've noticed if I've entered the wrong domain (.gov, .com, .net) in a URL, the site is redirected to the correct site instantaneously . For example, www.usps.gov --> www.usps.com. Is this the browser, the site itself or something else causing the redirect?

share|improve this question
    
In your example they are exactly the same site. –  Ramhound Apr 13 '12 at 11:32

1 Answer 1

up vote 7 down vote accepted

There are many mechanisms that can cause this to happen. In this case it is the web server that is doing the redirect:

--2012-04-13 10:22:01--  http://www.usps.gov/
Resolving www.usps.gov... 56.0.36.150
Connecting to www.usps.gov|56.0.36.150|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://www.usps.com [following]
--2012-04-13 10:22:02--  http://www.usps.com/
Resolving www.usps.com... 184.84.25.188
Connecting to www.usps.com|184.84.25.188|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://www.usps.com/ [following]
--2012-04-13 10:22:03--  https://www.usps.com/
Connecting to www.usps.com|184.84.25.188|:443... connected.
HTTP request sent, awaiting response... 200 OK

Your browser makes a connection to the webserver at www.usps.gov, which replies with a 302 Moved Temporarily error , which tells the browser that the site is now at www.usps.com. Browsers are generally configured to automatically accept 302 type errors and go to the new site indicated. In this case, the new site also issues a 302 error, and says to go to https://www.usps.com, the secure version of the site.

Note that if you are using firefox, you can get it to tell you when a site is attempting to redirect in Advanced / General options. Then you can see the jumps for yourself.

For details on various methods, see http://en.wikipedia.org/wiki/URL_redirection (.htaccess, html redirect, server-side scripting, 301, etc) and http://en.wikipedia.org/wiki/CNAME_record (DNS redirect)

share|improve this answer
2  
For details on various methods, see en.wikipedia.org/wiki/URL_redirection (.htaccess, html redirect, server-side scripting, 301, etc) and en.wikipedia.org/wiki/CNAME_record (DNS redirect). –  MaQleod Apr 13 '12 at 1:47
1  
@MaQleod thanks for that, I have added this to the answer to make it more thorough (feel free to edit these in yourself rather than in comments if it increases the quality of the answer) –  Paul Apr 13 '12 at 2:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.