How can I prevent visitors from accessing my site by IP? For example, my website uses IP 220.127.116.11, when they access http://18.104.22.168 directly, I want to redirect them to www.mywebsite.com or show them an error message.
I'm using Apache 2.2. Thanks!
LazyOne pointed out that you can do this with
I don't really see the value of doing this: Everyone accesses your website by IP address (after a DNS lookup turns your name into an IP), so the only real difference is what shows up in the
Aside from reading here: http://httpd.apache.org/docs/2.0/mod/mod_access.html
You can always drop via tcpwrappers /etc/hosts.deny or iptables :P