How to deny access to users who enter my server's IP into their browser?

Discussion in 'Apache' started by JD_2020, Sep 30, 2006.

  1. #1
    Hi --

    My problem is simple. I'd like to be able to block all traffic to those who enter my IP into their web browser. I have a private web server that has a domain name pointing to it. The domain name works fine.

    However, if a person who happens to know my server's IP decides to enter it into a web browser, they can view my website without knowing the domain name.

    I do not want this. So I figured there would be some way via .htaccess to block those who enter my IP as the URL... Any ideas?

    Thanks,
    -JD
     
    JD_2020, Sep 30, 2006 IP
  2. jduguay

    jduguay Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I would investigate using NameVirtualHosts. They actually look at the domain being sent by the browser to direct traffic within Apache. So you could have a default VirtualHost that captures the people entering the IP. At that point, you could just deny access or redirect them to the domain you want them to use.

    Just a thought.
    Joey
     
    jduguay, Oct 5, 2006 IP