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 (@)?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.