Page 1 of 1

HTTPS and authentication problem

PostPosted: 19. September 2006 11:05
by lpastor
Hello,

I have put a .htaccess like this in a directory :

RewriteEngine On

RewriteCond %{HTTPS} "off"
RewriteRule ^(.*)$ https://%{SERVER_NAME}/test/$1 [R=301,L]

AuthName "xampp user"
AuthType Basic
AuthUserFile "D:\Xampp\xampp\security\xampp.users"
require valid-user

That work well, I have the redirection http -> https, but the window of authentification appears systematically twice. How to have it only once?

If I delete this (

AuthName "xampp user"
AuthType Basic
AuthUserFile "D:\Xampp\xampp\security\xampp.users"
require valid-user

) I haven't authentication.


For information my alias "test" in httpd.conf is :

Alias /test "D:/Xampp/xampp/htdocs/Tests/"

<directory "D:/Xampp/xampp/htdocs/Tests">
Options Indexes MultiViews Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</directory>

Thanks in advance,

Laurent

PostPosted: 19. September 2006 11:19
by Izzy
Have you tried putting the authentication instructions at the top of the htaccess file above the rewrite directive?

PostPosted: 19. September 2006 12:18
by lpastor
Yes I do that, its the same problem.

And if I delete (
RewriteEngine On

RewriteCond %{HTTPS} "off"
RewriteRule ^(.*)$ https://%{SERVER_NAME}/test/$1 [R=301,L]
)

then I have only one authentication (that's good) but without https redirection.

Laurent

PostPosted: 19. September 2006 14:23
by lpastor
I have found the solution without .htaccess

In the httpd.conf :

<directory "D:/Xampp/xampp/htdocs/Tests">
Options Indexes MultiViews Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

RewriteEngine On
RewriteBase /htdocs/Tests
RewriteCond %{HTTPS} "off"
RewriteRule ^(.*)$ https://localhost/test/$1
</directory>

And in the httpd-ssl.conf :

<Directory "D:/Xampp/xampp/htdocs/Tests">
AuthName "xampp user"
AuthType Basic
AuthUserFile "D:\Xampp\xampp\security\xampp.users"
require valid-user
</Directory>