What is causing this 301 redirect? [closed] What is causing this 301 redirect? [closed] linux linux

What is causing this 301 redirect? [closed]


You should add a '/' at then end of your URLs. Furthermore if you run ab http://foo.com it will return you a "ab: invalid URL" error. If you do "ab -t 10 http://example.com/" everything will work fine. You should always use '/' in your URLs otherwize your webserver will try to redirect the page to the home page automatically for you which generates an undesirable extra load on the server and some extra bytes on the wire.

You web server told you what it did:

'/' is missing and something is incorrect with the port numer:

# curl -I http://www.mylesgray.com:8080HTTP/1.1 301 Moved Permanently[...]======> Location: http://www.mylesgray.com/

'www' and '/' are missing:

# curl -I http://mylesgray.comHTTP/1.1 301 Moved Permanently[...]=======> Location: http://www.mylesgray.com/[...]

'/' and 'www' are missing:

# curl -I http://mylesgray.com:8080HTTP/1.1 301 Moved Permanently[...]========> Location: http://www.mylesgray.com/

'hope that helps :)


The presence of an X-Powered-By: PHP header means that wordpress is issuing the 301. It's due to wordpress forcing www.mylesgray.com. When you use a nonstandard port, user agents will generally include the port in the Host: header. Try adding

fastcgi_param HTTP_HOST $host;

with the rest of your fastcgi_param directives (or alog with your "include fastcgi_params;") and it should fix this.