سؤال

My site is currently accessible to the server's ip via browser. I want to disable this and everyone should go through using domain name like www.mydomainsite.com.

For example, if I type 58.123.45.18 (not a real ip) in the browser it still goes to the site. We have a proxy server sitting between the dns and web server and we want to track anyone who comes in. But w00tw00t.at.blackhats.romanian.anti-sec still get in using the IP.

My google search return this: http://support.microsoft.com/kb/324066 and I dont want to do this.

Is this even possible in the first place??

هل كانت مفيدة؟

المحلول

It's not possible to prevent a browser from connecting to your site using an IP address. After all, for this purpose, the DNS system is simply a friendly name layer on top of IP addresses.

The only thing you can really do is filter the URLs that are presented to your web server. While you can certainly do this at the application layer, you're far better off using the capabilities already built into your web server for doing this.

I assume you're using IIS based on the link you posted. Any good reason for not using the built-in capability to accomplish what you want?

نصائح أخرى

You can't disable accessing the server with your ip but you can redirect direct access with the IP address to your domain which will then be resolved and redirect the browser back to your server. You can achieve this by placing a .htaccess file in your BROWSING home directory. Note: this is not your home directory. Your browsing home directory is usually /var/www/ or /home/admin/web/{domain.ltd}/public_html

RewriteEngine On
RewriteCond %{HTTP_HOST} ^1\.2\.3\.4$
RewriteRule ^(.*)$ https://wordcounted.com/$1 [L,R=301]

Assuming your public IP is 1.2.3.4

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top