Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is a website when you visit certain links it redirects you to another site.

Is there any way I can find out what HTTP code is returned before they redirect you?

share|improve this question
up vote 3 down vote accepted

Sure, try curl:

$ curl -k
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<H1>301 Moved</H1>
share|improve this answer
That sort of worked. The link I tested showed just Object Moved, then the link to the new location. I tried the same with wget and it showed 302 Found, then after following the link it showed 302 Moved Temporarily. Thanks for pointing my in the right direction. – Shane Grant Oct 15 '11 at 2:18

curl, wget, ... and other command line web browsers may not be available in all OS, just use telnet instead:

$ telnet localhost 81
Connected to localhost.
Escape character is '^]'.
GET /one/two?path=x&y=z HTTP/1.0
HTTP/1.1 301 Moved Permanently
Server: nginx/1.0.5
Date: Sat, 15 Oct 2011 02:38:59 GMT
Content-Type: text/html
Content-Length: 184
Connection: close

You can also pass the Host header:

telnet www.ganglia.gentoo 80
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0
Host: www.ganglia.gentoo
HTTP/1.1 301 Moved Permanently
Date: Sat, 15 Oct 2011 02:45:41 GMT
Server: Apache
Location: http://nagios.gentoo/
Content-Length: 297
Connection: close
Content-Type: text/html; charset=iso-8859-1
share|improve this answer

Your Answer


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.