Skip to main content

How to only allow certain IPs to hit specific HTML pages?

Comments

3 comments

  • cPRex Jurassic Moderator
    Hey there! Inside cPanel there is the IP Blocker tool. Using that interface adds the following code to the local .htaccess file for the user: order allow,deny allow from all deny from 1.2.3.4
    so you could use that template to manually add a list of IPs you don't want to access the site. As for the firewall level, I don't have any details that would let you do per-domain or per-vhost, as those would be all or nothing.
    0
  • rolinger
    @cPRex - thanks for the response (again). Can the reverse of that be done...only permit a few IPs, deny the rest? order allow,deny allow from 1.1.1.1, 2.2.2.2, 127.0.0.1l deny from all
    As well....how does that target my *.php files only? I am not too proficient with Apache .htaccess files.
    0
  • cPRex Jurassic Moderator
    Sure - something like this would do the trick for PHP files: Order allow,deny allow from 1.1.1.1, 1.1.1.2, etc..... Deny from all
    There's much more reading on the .htaccess rules here:
    0

Please sign in to leave a comment.