htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Require SSL before asking for htaccess password!
PostPosted: 27 Sep 2006 07:10 
Offline
User avatar

Joined: 25 Sep 2006 04:48
Posts: 242
This code redirects http://secure.example.com/login.php to https://secure.example.com/login.php BEFORE it prompts you for your htaccess password.

This is if the htaccess file is in the / folder where login.php resides.

What is happening is that when a user makes a non-SSL encrypted request in the / folder, the SSLRequireSSL directive issues a 403 Error back, then the ErrorDocument redirects to the https page and THEN the htaccess password prompt appears.

This gets rid of the double-login double prompts for htaccess passwords that occur when the domain is different.

Code:
SSLRequireSSL
ErrorDocument 403 https://secure.example.com/login.php

AuthUserFile /wwwroot/.htpasswd
AuthGroupFile /dev/null
AuthName "webmail"
AuthType basic
require valid-user


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB