How can I prevent visitors from accessing my site by IP? For example, my website uses IP 18.104.22.168, when they access http://22.214.171.124 directly, I want to redirect them to www.mywebsite.com or show them an error message.
I'm using Apache 2.2. Thanks!
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
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