Linode.com Forum Forum Index Linode.com Forum
Linode Community Forums
 


.htaccess to require passwords, block IPs, and require HTTPS

Click here to go to the original topic

 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Author Message
brandondrew



Joined: 06 Jul 2007
Posts: 1

Posted: Fri Jul 06, 2007 4:13 pm    Post subject: .htaccess to require passwords, block IPs, and require HTTPS  

I've got an .htaccess file, and everything works except the redirection to HTTPS. If I remove everything else, that part works, but when it's all there together, it fails.

Thanks in advance for any help you can offer!


# require a password
AuthUserFile /blah/blah/blah/.htpasswd
AuthGroupFile /dev/null
AuthName Locked_Down
AuthType Basic
<Limit GET>
require valid-user

order deny,allow
# allow from office network:
allow from x.y.z
# allow from my home office IP:
allow from a.b.c.d
# deny from everyone else:
deny from all
</Limit>


# force HTTPS
# this worked in tests in isolation, but not here:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteEngine Off
Back to top  
 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Page 1 of 1