Few days ago a friend asked me for help: after installing some wordpress plugin, the pages refuse to load.
The Internet Explorer browser seems to do some work but the page never success to load.
So, I’ve try to use a different browser: Firefox.
It seems to work in the same way (page never loaded), but in the end I got a message like this: “Firefox has detected that the server is redirecting the request for this address in a way that will never complete.”
Hmm… that seems to be really strange, it seems to be Redirect HTTP response/header but we are nor sure… yet.
So, I’ve remember that there are some good command line tools like “curl” or “wget” that can tell me more about a page.
At that moment I was on a windows machine, and having cygwin environment installed, and fortunately the wget was already installed.
Cygwin is a unix like environment that can be installed on a windows machine.
Install this and you will get almost all the scripting languages available on a unix machine: perl, python, tcl, php, etc.
Now back to wget… running “wget –help” was easy to identify a wget switch/argument “-S”, it says:
-S, --server-response print server response.
So I’ve just used something like “wget -S http://www.example.com/a_page” and I’ve notice the problem: that page is sending back a 301 Redirect to himself, a kind of never eneding loop.
E.g. If it would be my web host, I would have something like
$ wget -S http://www.notnull.ro/log/
--2013-06-17 22:57:15-- http://www.notnull.ro/log/
Resolving www.notnull.ro (www.notnull.ro)... 176.9.70.183
Connecting to www.notnull.ro (www.notnull.ro)|176.9.70.183|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 301 Moved Permanently
Date: Mon, 17 Jun 2013 19:59:01 GMT
Server: Apache/2.2.16
Location: http://www.notnull.ro/log/
Vary: Accept-Encoding
Content-Length: 0
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Location: http://www.notnull.ro/log/ [following]
--2013-06-17 22:57:16-- http://www.notnull.ro/log/
Resolving www.notnull.ro (www.notnull.ro)... 176.9.70.183
Reusing existing connection to notnull.ro:80.
HTTP request sent, awaiting response...
HTTP/1.1 301 Moved Permanently
Date: Mon, 17 Jun 2013 19:59:01 GMT
Server: Apache/2.2.16
Location: http://www.notnull.ro/log/
... and so on
As you probable already noticed the page http://www.notnull.ro/log/ is redirecting to http://www.notnull.ro/log/ , which is redirecting to http://www.notnull.ro/log/, which…
You can use the same technique if you play with the Rewrite Rules from Apache webserver. They are really powerful, but also dangerous. You may get in unwanted redirection, and o trace all this you may use the wget to retrieve all the redirection done.