title: How to configure Apache to reject (example) http://192.168.1.1 and accept only virtual hosts like http://www.example.com
body: <p>I tried to search for a solution on this but didn't know how to frame the query to get my answer.</p>
  
  <p>I want to block anyone from probing my server by IP urls (like <a href="http://192.168.1.1" rel="nofollow">http://192.168.1.1</a>  -- any public IP address) while allowing properly URLs to my server (proper like <a href="http://www.example.com" rel="nofollow">http://www.example.com</a>).</p>
  
  <p>I feel there are four ways:</p>
  
  <ol>
  <li><p>Create a virtual host entry in httpd.conf file that "traps an IP url.</p></li>
  <li><p>Create a mod_rewrite entry to rewrite IP url that also "traps" it.</p></li>
  <li><p>Create an IPTABLES entry that is capable of detecting IP urls and dropping those connection requests.</p></li>
  <li><p>Do nothing because nothing can be done.</p></li>
  </ol>
  
  <p>Which of the three (or recommend alternative) would be the best way to handle it.  How woudl I do it?</p>
  
  <p>Thanks.</p>