Jump to content

Allow access with domain.com but not by IP


fr600

Recommended Posts

Here is another thing:

 

Whenever someone visits www.domain.com, it opens up index.html.

 

And when someone visits IP address 12.34.56.78, it opens up the same index.html.

 

(@) I want to disallow access by IP address and allow access only by the www.domain.com.

 

The problem is that www.domain.com is pointed to my IP address 12.34.56.78 with A record.

 

So, when I block my IP, the domain gets blocked message.

 

How can I do that (@)?

The Internet works using IP addresses. When a URL is requested, the DNS system resolves the domain name to its' IP address and provides the IP address to the browser. A browser actually makes a request using the IP address (the browser puts the domain name in the host header in the request so that name based virtual hosting will work.)

 

If someone directly entered the IP address, the host header would be empty. This would be the only way you could detect if the site was reached directly through the IP address.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.