{"id":144,"date":"2013-06-17T20:42:32","date_gmt":"2013-06-17T20:42:32","guid":{"rendered":"http:\/\/www.notnull.ro\/log\/?p=144"},"modified":"2014-01-20T21:50:23","modified_gmt":"2014-01-20T21:50:23","slug":"wget-and-self-page-redirect","status":"publish","type":"post","link":"https:\/\/notnull.ro\/log\/wget-and-self-page-redirect\/","title":{"rendered":"wget &#8211; and self page redirect"},"content":{"rendered":"<p>Few days ago a friend asked me for help: after installing some wordpress plugin, the pages refuse to load.<br \/>\nThe Internet Explorer browser seems to do some work but the page never success to load.<br \/>\nSo, I&#8217;ve try to use a different browser: Firefox.<br \/>\nIt seems to work in the same way (page never loaded), but in the end I got a message like this: &#8220;Firefox has detected that the server is redirecting the request for this address in a way that will never complete.&#8221;<br \/>\nHmm&#8230; that seems to be really strange, it seems to be Redirect HTTP response\/header but we are nor sure&#8230; yet.<br \/>\nSo, I&#8217;ve remember that there are some good command line tools like <strong>&#8220;curl&#8221;<\/strong> or <strong>&#8220;wget&#8221; <\/strong>that can tell me more about a page.<br \/>\nAt that moment I was on a windows machine, and having <strong>cygwin<\/strong> environment installed, and fortunately the wget was already installed.<br \/>\nCygwin is a unix like environment that can be installed on a windows machine.<br \/>\nInstall this and you will get almost all the scripting languages available on a unix machine: perl, python, tcl, php, etc.<br \/>\nNow back to wget&#8230; running &#8220;wget &#8211;help&#8221; was easy to identify a wget switch\/argument &#8220;-S&#8221;, it says:<br \/>\n<code> <strong> -S,  --server-response         print server response.<\/strong><\/code><br \/>\nSo I&#8217;ve just used something like &#8220;wget -S http:\/\/www.example.com\/a_page&#8221; and I&#8217;ve notice the problem: that page is sending back a 301 Redirect to himself, a kind of never eneding loop.<br \/>\nE.g. If it would be my web host, I would have something like<\/p>\n<p><code>$ wget -S http:\/\/www.notnull.ro\/log\/<br \/>\n--2013-06-17 22:57:15--  http:\/\/www.notnull.ro\/log\/<br \/>\nResolving www.notnull.ro (www.notnull.ro)... 176.9.70.183<br \/>\nConnecting to www.notnull.ro (www.notnull.ro)|176.9.70.183|:80... connected.<br \/>\nHTTP request sent, awaiting response...<br \/>\n  HTTP\/1.1 301 Moved Permanently<br \/>\n  Date: Mon, 17 Jun 2013 19:59:01 GMT<br \/>\n  Server: Apache\/2.2.16<br \/>\n  Location: http:\/\/www.notnull.ro\/log\/<br \/>\n  Vary: Accept-Encoding<br \/>\n  Content-Length: 0<br \/>\n  Keep-Alive: timeout=15, max=100<br \/>\n  Connection: Keep-Alive<br \/>\n  Content-Type: text\/html; charset=UTF-8<br \/>\nLocation: http:\/\/www.notnull.ro\/log\/ [following]<br \/>\n--2013-06-17 22:57:16--  http:\/\/www.notnull.ro\/log\/<br \/>\nResolving www.notnull.ro (www.notnull.ro)... 176.9.70.183<br \/>\nReusing existing connection to notnull.ro:80.<br \/>\nHTTP request sent, awaiting response...<br \/>\n  HTTP\/1.1 301 Moved Permanently<br \/>\n  Date: Mon, 17 Jun 2013 19:59:01 GMT<br \/>\n  Server: Apache\/2.2.16<br \/>\n  Location: http:\/\/www.notnull.ro\/log\/<br \/>\n... and so on<br \/>\n<\/code><\/p>\n<p>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&#8230;<\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;ve try to use a different browser: Firefox. It seems to work in the same way (page never loaded), <a href='https:\/\/notnull.ro\/log\/wget-and-self-page-redirect\/' class='excerpt-more'>&#8230; Read Full Article<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[75,62,16,44,43],"class_list":["post-144","post","type-post","status-publish","format-standard","hentry","category-internet","tag-75","tag-apache","tag-recursive","tag-redirect","tag-wget","category-42-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/posts\/144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/comments?post=144"}],"version-history":[{"count":7,"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/posts\/144\/revisions"}],"predecessor-version":[{"id":153,"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/posts\/144\/revisions\/153"}],"wp:attachment":[{"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/media?parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/categories?post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notnull.ro\/log\/wp-json\/wp\/v2\/tags?post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}