A client installed a plugin to create redirections using an administration and he was having some issues. The problem is that browsers heavily cache http responses (specially 301 redirects) and I was tired of erasing the cache to get real time results. The most pragmatic solution I found for checking HTTP headers was using Curl. To install Curl on MacOS X, please use homebrew:
mau-mac:~ iMac21$ brew install curl
Basically you can get just the HTTP headers from any given URL:
mau-mac:~ iMac21$ curl -I http://www.culver.org/polo/ HTTP/1.1 301 Moved Permanently Date: Tue, 18 Sep 2012 23:01:36 GMT Server: Apache/2.2.14 (Ubuntu) X-Powered-By: PHP/5.3.2-1ubuntu4.17 Set-Cookie: 9622d07dca107167f1aed364522889ce=88uj57gtfgtmqs89d3cd3bgt54; path=/ P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Location: http://www.culver.org/academics/quick-start/academic-departments/horsemanship/organizations/polo Vary: Accept-Encoding Content-Type: text/html
As you can see, using the command “curl -I” , we can get the headers from the URL http://www.culver.org/polo/ and check it is doing a permanent redirect (301).
If you want to return just the HTTP status and not all headers, we can add Grep to Curl:
mau-mac:~ iMac21$ curl -I http://www.culver.org/polo/ | grep HTTP % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 HTTP/1.1 301 Moved Permanently
This command was executed in MacOX but I am pretty sure it would work in The majority of Linux Distros with Curl installed.
The command line is powerful, use it.