Help with .htaccess & .htpasswd use please

by Ant B
3 replies
I want to be able to allow access to my website from all IP addresses except for those I specify as requiring authentication.

Could someone tell me what I would need in my .htaccess and .htpasswd files pelase? I have been looking but struggling to get anything working.

Thanks
#htaccess #htpasswd
  • Profile picture of the author duong0905
    Hi,
    Try this:
    RewriteCond %{REMOTE_ADDR} xxx\.xxx\.xxx\.xxx [OR]
    RewriteCond %{REMOTE_ADDR}
    yyy\.yyy\.yyy\.yyy
    RewriteRule . /mydomain(dot)com/login [L]
    {{ DiscussionBoard.errors[4949850].message }}
    • Profile picture of the author murrad
      You can write this snippet on your .htaccess file.

      order allow,deny
      deny from <ip_to_block_accessing>
      allow from all

      for multiple IPs go next line

      order allow,deny
      deny from <ip_to_block_accessing>
      deny from <ip_to_block_accessing1>
      deny from <ip_to_block_accessing2>
      allow from all

      etc.,

      Hope this helps!
      {{ DiscussionBoard.errors[4951100].message }}
  • Profile picture of the author wasabi20
    You can found more information here; Using .htaccess file
    {{ DiscussionBoard.errors[5029797].message }}

Trending Topics