Forum Moderators: phranque

Message Too Old, No Replies

Why is the 301 HTTP error code returned when I use the IP address?

Using IP address for domain returns 301; domain name returns 200

         

zollerwagner

10:23 am on Mar 25, 2003 (gmt 0)

10+ Year Member



When I check the index page (by just pointing to the domain) in: [wannabrowser.com...]
using the ip address of my site it returns these headers:

HTTP/1.1 301 Moved Permanently
Date: Tue, 25 Mar 2003 10:17:45 GMT
Server: Apache
Location: [xx.xx.xx.xx...]
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 200 OK
Date: Tue, 25 Mar 2003 10:17:45 GMT
Server: Apache
Transfer-Encoding: chunked
Content-Type: text/html

If I check using the domain name, it returns:

HTTP/1.1 200 OK
Date: Tue, 25 Mar 2003 10:19:44 GMT
Server: Apache
Transfer-Encoding: chunked
Content-Type: text/html

I'm confused by these results. Is something wrong? There isn't any redirect that I know of in my .htaccess for this page.

TIA for any thoughts!

Dreamquick

10:36 am on Mar 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it a dedicated server or a shared virtual server?

Specifically does it have it's own IP?

- Tony

zollerwagner

10:55 am on Mar 25, 2003 (gmt 0)

10+ Year Member



Hi, Dreamquick,

It's a shared server, so the IP is followed by /~MyLogin

Thanks for the quick response!

Dreamquick

1:24 pm on Mar 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are using something like "127.0.0.1/~mylogin" and redirects you off to "127.0.0.1/~mylogin/", then that sounds like something your host has configured to make their lives easier.

You say you can go straight to a domain name and it works perfectly - so I assume the IP address thing is more of a curiousity than a real issue?

- Tony

andreasfriedrich

2:42 pm on Mar 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It seems that your host is using name based hosting. If you request a URL simply by IP no Host header field containing your host name can be added to the request. Then the server will have no way of telling which name based host should handle the request. So handling will fall through to the default host which in your case redirects to [xx.xx.xx.xx...]

>>There isn't any redirect that I know of in my .htaccess
>>for this page.

Redirect [httpd.apache.org] directives can be used in httpd.conf as well.

Andreas

zollerwagner

7:03 pm on Mar 25, 2003 (gmt 0)

10+ Year Member



Duh...feeling a little stupid here.

It makes sense that the use of an IP address and login name would necessarily involve a redirect to the domain name.

It doesn't sound as though anything in this is a matter for concern.

Thanks to both of you!