Apache: Disable Access By Server's IP Address

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am running a couple virtual hosts on Apache (windows) and was
wondering if there is a way to disable access to the web pages via IP

For example, I only want the actual websites accessible by someone
typing in the domain name.

Currently, if someone types in, it pulls up the main web
site I'm hosting.  I would like to disable this so the only way to get
to the main site is by typing http://www.mysite.com .

Thanks for the assistance!

Re: Apache: Disable Access By Server's IP Address


thatguy26 wrote:

Quoted text here. Click to load it

Define another virtual host, which must be the first in the apache.conf.
Something like

<VirtualHost *>
    ServerName default
    Redirect 404 /

The first virtual host will be used by apache for any host name that is not
used by one of your 'real' virtual hosts, including access by IP address.


Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de /

Site Timeline