htaccess_files_allowing_from_ip_address
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
htaccess_files_allowing_from_ip_address [2025/03/20 19:37] – removed - external edit (Unknown date) 127.0.0.1 | htaccess_files_allowing_from_ip_address [2025/03/20 19:37] (current) – ↷ Page name changed from htaccess_files to htaccess_files_allowing_from_ip_address juckins | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ==== Apache .htaccess files and Allowing from IP Address ==== | ||
+ | [[http:// | ||
+ | [[http:// | ||
+ | to create a new password file: | ||
+ | < | ||
+ | # htpasswd -c / | ||
+ | New password: mypassword | ||
+ | Re-type new password: mypassword | ||
+ | Adding password for user rbowen | ||
+ | </ | ||
+ | |||
+ | to append to existing password file: | ||
+ | < | ||
+ | # htpasswd / | ||
+ | New password: mypassword | ||
+ | Re-type new password: mypassword | ||
+ | Adding password for user rbowen | ||
+ | </ | ||
+ | |||
+ | To allow access to [[http:// | ||
+ | < | ||
+ | # Refuse direct access to all files | ||
+ | Order deny,allow | ||
+ | Deny from all | ||
+ | Allow from 127.0.0.1 | ||
+ | Allow from localhost | ||
+ | Allow from 192.168.1.0/ | ||
+ | </ | ||
+ | Then create an .htaccess file in whatever directories you want to allow access to: | ||
+ | < | ||
+ | Allow from all | ||
+ | </ | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | Example: | ||
+ | |||
+ | AuthUserFile / | ||
+ | AuthName " | ||
+ | AuthType Basic | ||
+ | require user [username] | ||
+ | satisfy any | ||
+ | deny from all | ||
+ | allow from 192.168.1. | ||
+ | allow from 10.1.1.45 | ||
+ | allow from 172.16.5.106 |