Advertisement
Guest User

HTTPS ReWrite + Basic Auth + IP Whitelist + FilesMatch

a guest
Mar 27th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.39 KB | None | 0 0
  1. RewriteEngine On
  2. RewriteBase /folder/
  3.  
  4. RewriteCond %{HTTPS} off
  5. RewriteRule ^(.*)$ https://www.example.com/folder/$1 [R=301,L]
  6.  
  7. <FilesMatch "file.php">
  8. <If "%{HTTPS} == 'on' && %{REMOTE_ADDR} != '1.2.3.4'">
  9. AuthType Basic
  10. AuthName "Password Required"
  11. AuthUserFile /home/example/public_html/folder/.htpasswd
  12. Require valid-user
  13. ErrorDocument 401 "Authorisation Required"
  14. </If>
  15. </FilesMatch>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement