IP restriction using htaccess

7 replies
After putting this code below in my htaccess file, what will this show as in the browser?

<Limit GET POST PUT>
order deny,allow
deny from all
allow from xx.x.xxx.xxx
</Limit>
#htaccess #restriction
  • Profile picture of the author singh1720
    I think it was more important for all of us WordPress users to consider taking security issues and htaccess even more seriously. You can get information and solution on askapache.com/htaccess/php-cgi-redirect_status.html
    {{ DiscussionBoard.errors[6137622].message }}
  • Profile picture of the author Earnie Boyd
    Originally Posted by Aihakdsweet View Post

    After putting this code below in my htaccess file, what will this show as in the browser?

    <Limit GET POST PUT>
    order deny,allow
    deny from all
    allow from xx.x.xxx.xxx
    </Limit>
    Except for xx.x.xxx.xxx a user accessing the server in a browser would see a 403 Forbidden error. See HTTP 403 - Wikipedia, the free encyclopedia for more.
    Signature
    {{ DiscussionBoard.errors[6153438].message }}
    • Profile picture of the author Karen Blundell
      Originally Posted by Earnie Boyd View Post

      Except for xx.x.xxx.xxx a user accessing the server in a browser would see a 403 Forbidden error. See HTTP 403 - Wikipedia, the free encyclopedia for more.
      Earnie's response is the correct one. User's will get the 403 forbidden message when you block IP addresses using your .htaccess file.
      Signature
      ---------------
      {{ DiscussionBoard.errors[6379455].message }}
  • Profile picture of the author brandonthomas
    Banned
    In order to restrict access to Web pages, you must place a ".htaccess" file in the directory to which you want to restrict access.
    {{ DiscussionBoard.errors[6290315].message }}
  • Profile picture of the author filipbekic01
    i think it is going to show you like "Forbidden Page"
    {{ DiscussionBoard.errors[6388176].message }}
  • Profile picture of the author thrhei
    It will block all ip address and will only allow access to xx.x.xxx.xxx
    {{ DiscussionBoard.errors[6389600].message }}
  • Profile picture of the author eluminousdev
    Here is line by line explantion :
    1. <Limit GET POST PUT>
    >> Above line is for the reason is, rule is written and restricted for the GET/POST/PUT.
    2. order deny,allow
    >> The rule for prioritizing the orders for next line rule. So here it is deny, allow and hence because this lines comes first "deny from all" and after that "allow from xx.x.xxx.xxx"
    3. deny from all
    >> This rule of line for restrict the access from all IP addresses

    4. allow from xx.x.xxx.xxx
    >> This rule of line for only allow the access of webpage for the listed IP which would be in this format.
    e.g if we replace "xx.x.xxx.xxx" with "255.1.42.345" then webpage is only accessible for this IP and will not be visible for any other IP.
    </Limit>

    Hope this explanation helps.
    {{ DiscussionBoard.errors[6389899].message }}

Trending Topics