Disable IP access in browser but domain name still accessible

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 (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

Need Your Help

how do reference a source directory from and artifiact declared as a dependency

maven rpm maven-assembly-plugin

I have an assembly module that builds the directory structure I need under the target directory. All folders are there as expected. These dirs include config, docs, lib etc. Some include jars while...

Scala Future with filter in for comprehension

scala filter future for-comprehension

In the example below I get the exception java.util.NoSuchElementException: Future.filter predicate is not satisfied