fr600 Posted August 4, 2008 Share Posted August 4, 2008 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 (@)? Quote Link to comment https://forums.phpfreaks.com/topic/118020-allow-access-with-domaincom-but-not-by-ip/ Share on other sites More sharing options...
texerasmo Posted August 7, 2008 Share Posted August 7, 2008 Try You can add VirtualHost in http.con winth your ip and la yoour DocumentRoor=welcome of apache Quote Link to comment https://forums.phpfreaks.com/topic/118020-allow-access-with-domaincom-but-not-by-ip/#findComment-610678 Share on other sites More sharing options...
PFMaBiSmAd Posted August 7, 2008 Share Posted August 7, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/118020-allow-access-with-domaincom-but-not-by-ip/#findComment-610684 Share on other sites More sharing options...
texerasmo Posted August 7, 2008 Share Posted August 7, 2008 Ok You have add two VirtualHost 1) For your IP (welcome di apache) 2) For your website I did a test and it works Quote Link to comment https://forums.phpfreaks.com/topic/118020-allow-access-with-domaincom-but-not-by-ip/#findComment-610692 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.