The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Bypass htaccess Using Hosts File On Local PC ?

Discussion in 'Security' started by Dushy Squirt, Mar 10, 2013.

  1. Dushy Squirt

    Dushy Squirt Member

    Joined:
    Mar 7, 2013
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi,

    If I have a htaccess file setup using cPanel in the public_html directory of a website to only allow specific IP's through to view the site can this be bypassed by adding a line to the hosts file on anyones local PC.

    For example, if I added the line

    domain.com 127.0.0.1

    to the host file of anyones local PC where that local PC IP address was not in the website htaccess file will that PC be able to view the website?


    Thx
     
  2. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    That line:
    in the hosts file means that domain.com resides in the same computer where that hosts file is.
    127.0.0.1 (i.e. "localhost") always refers to the computer itself.
     
  3. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    941
    Likes Received:
    55
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    The hosts file on your local machine is only used to (re)define IP's for domain names. For example if you were migrating a site, you can change your local 'hosts' file to point to the new server instead of where DNS resolves. Assuming you don't use a proxy, your local 'hosts' file will not cause a remote server to see you as coming from a different IP. You can't bypass .htaccess restrictions on a remote sever this way.
     
Loading...

Share This Page