Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I found that many websites display their site content only when you access them by their FQDN (example, example.com). When trying to access by their IP address, they show a 404 site not found error. Are there good reasons why site owners would not want their websites to be directly accessible by IP address instead of going through the DNS?

What are the pros and cons of making direct IP access available for your website?

share|improve this question

6 Answers 6

up vote 20 down vote accepted

Note that the website that is reached through a domain name might not be hosted directly at the root of the IP address, i.e. example.org could map to 123.45.67.89/~example. This is common for normal web hosts since they can't allocate an IP address per website – that would be incredibly wasteful.

For instance, if you do a DNS lookup of webmasters.stackexchange.com, you'll get the IP address 198.252.206.140 (on the right-hand side on the website I linked to). While the IP address does go to a StackExchange page, it doesn't lead to the webmasters section, which might be at something like 198.252.206.140/www/webmasters.

One con of using an IP address (or something like 123.45.67.89/~example) is the need for a static IP address. If, for some reason, the IP address should have to change, you have no way of redirecting users. Whereas with a domain name, it's simply a matter of updating DNS records to point to the new IP address.

While not completely related, another obvious con of IP addresses is that they're a lot harder to remember than a name and an ending.

By default, a website will be available through the domain name, as well as by IP address. Different answers/comments to this question offer different perspectives, and I don't want to copy off of that.

Personally, I wouldn't block access by IP address, simply because that's not how one would expect the internet to work. Additionally, a regular user will never randomly find the IP address of your website, and he definitely won't start sharing links to your site with the IP address. So any efforts for SEO optimization and security are surely better spent elsewhere.

share|improve this answer
3  
I don't think your last two paragraphs answer the question. In my understanding of the question, the OP is not asking whether it is ok to offer a website only via an IP address rather than a domain name, but whether there are any reasons to intentionally prevent users from ever accessing the website via the IP address. –  O. R. Mapper Jun 27 at 11:34
2  
One small correction: in and of itself, a whois lookup will only show you the registration status and contact information for a domain name. The IP address is determined by a DNS record lookup. Who.is is a service that just happens to show you both when looking up a domain name. Also, you will only find whois info for stackexchange.com, and not webmasters.stackexchange.com. gwhois.org/webmasters.stackexchange.com+dns –  iglvzx Jun 27 at 12:17
    
@O.R.Mapper and iglvzx: Thank you both very much! I've updated my answer to fix your remarks, trying to copy as little as possible from the other answers, which were very interesting to read. –  ljacqu Jun 27 at 12:39
    
youtube as well - if you ping youtube, and get the IP address 173.194.41.161, you end up getting Google's home page. –  Wilf Jun 27 at 18:51
    
Thank you for the comprehensive answer. –  Question Overflow Jun 28 at 2:11

Especially if you have a shared hosting or a server of your own hosting multiple domains you can't access the "website" via IP. For your own server you could possibly define a primary domain that is reached if you enter the IP. For shared hosts that is impossible.

As mentioned by @Ijacqu the IP could easily change.

Another thing is duplicate content, so basically it's no good practice to do so.

If you want to have a website to be reached via it's server IP you should definately add a 301 or 302 forward to the domain itself.

For one server I administered I added a small HTML site, just echoing "Welcome to 123.456.789.123" as a default website, as several customer projects were hosted on that machine, and I just needed a white label solution for the default site. I configured that using apache vhosts.

share|improve this answer

The original version of HTTP did not include any mechanism for the client to specify the host name as part of the request. It connected to the server and sent only the path portion of the URL. One of the early modifications to the HTTP protocol was to add the ability for the client to send other "header" information, including the host name.

20 years ago browser support for virtual hosts was very spotty. Back then, there would have been a valid reason to serve the content from just the IP address as well. A small percentage of clients would not have sent the host header. The host name is now a standard header sent by every browser and web crawler.

In fact, I find that requests looking for content on an IP address are not likely to be satisfied if my server responds with my website. I tend to see IP only requests that are:

  • For a website that used to be on that IP address
  • Attempts for access by malware

I now prefer to serve a 404 error for just IP address requests rather than serving my site or redirecting to my site. My servers are also configured to serve 404 pages to unrecognized host names as explained in the answer to How to deal with malicious domain redirections?

share|improve this answer
    
I occasionally try accessing websites via their IP address; everytime when I suspect something fishy may be going on with my DNS. In those situations, I try to find out the IP address for the website and open the website via that. If the website I'd expect from the normal domain name loads fine via its IP only, I know I have to fix something about my DNS, but if I get an error message, I would always assume something is broken on the website's server and I just have to wait till it is fixed. –  O. R. Mapper Jun 27 at 11:37
    
So many web sites use shared hosting these days that expecting to be able to access them without a host name is not practical. This StackExchange website is not available with just the IP address. There are many StackExchange subdomain websites that share it. StackExchange shows a custom 404 page if you try it with just the IP address. –  Stephen Ostermiller Jun 27 at 11:48

From SEO perspective it is a disaster.

If you have one website for example stackexchange.com and it is also accessible from the ip address this will lead to duplicate content.

This will destroy your rankings, and will confuse your users, which they will search Google and find 2 results for the same topic (one accessible by the domain name, and one accessible by the ip address)

Never make a domain accessible from the ip address.

If you got one domain hosted on a single server, the best approach is to 301 redirect direct ip address access to that domain.

If you have more than one domains on a server, disable direct ip address access.

share|improve this answer
4  
I have been at this since ARPA-NET. This statement is simply not true. In the beginning, there was no virtual hosting and all websites were accessible via the domain name AND IP address. This is still extremely common today. Search engines are smart enough to know what domain names are served by what IP addresses and DO NOT count this as duplicate content but the same site. –  closetnoc Jun 27 at 17:41
    
By website was destroyed, after an update of nginx that I didnt fixed the default server. It took 6 months to 301 all 10.000.000 crawled links in direct ip address access :( –  krokola Jun 27 at 19:55
    
And if you think that there are no SEO problems (but I totally disagree with you), there is a very big issue with hits. Bots will make double hits to crawl the same content. If your website receives 2.000.000 bot hits per day, and you allow direct ip address access, bots will make 4.000.000 will totally no benefit for you. –  krokola Jun 27 at 20:18
1  
For SEO, it is possible to add a <link rel="canonical" href="http://example.com" /> to avoid duplicate content. –  Question Overflow Jun 28 at 2:14
2  
This answer is definitely not true. Many websites are accessible on their IP address, it does not cause search engines headaches, it won't kill your "SEO." Duplicate content is a technical problem that has been around since the beginning of the web, search engines have various ways of dealing with it. It's not the end of the world. That said, if you have a preference regarding indexing, adding a rel=canonical is a great way to guide search engines towards that. –  John Mueller Jul 1 at 20:46

Just my 2 cents, I have a few web sites on my web server (about 8) and they all have the exact same IP address. With the use of Host Headers, the FQDN helps the web server (in my case Apache) to direct the request to the correct directory for the web site in question. The IP address is directed to my company Website by default. I have found since around 2001 this is the norm for most web hosting providers, especially considering the current state of IPv4 addresses. Just some background, I worked for Voyager.net (in Michigan) for about 8 years and Voyager was a hosting company and ISP that hosted over 80,000 domain and I don't know how many web sites we hosted. In a side note, FQDN is by definition used to give human readable addresses to IP address so we can remember them more easily. Again just my 2cents.

share|improve this answer

From a security perspective, it is a smart move.

Most websites with heavy traffic will have a CDN used somewhere. So any attempted DOS or DDOS attack will simply dissipate away through the CDN servers and won't reach the user site.

However, if a user is aware of the site's IP address, he or she can directly fire an attack at the IP and bring down the server in no time. That's why most CDNs will offer you options to hide your server's IP addresses. So giving a 404 to someone who is trying to access the site is a good move. It can be wither done by a .htaccess file or by hosting the site at a place other than the default server document root.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.