Welcome Guest, Not a member yet? Register   Sign In
.htaccess authentication does not stop page loading
#1

[eluser]Unknown[/eluser]
Hi

I have the following code in my .htaccess:

Code:
AuthType basic
AuthUserFile "/home/site/.htpasswds/public_html/passwd"
AuthGroupFile /dev/null
AuthName "Secure directory"
Require valid-user

RewriteCond $1 !^(images|scripts|stylesheets|documents|slideshow)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/?$1 [L]

Putting in the correct password and the website works perfectly.

However clicking cancel in the authentication box simply makes the authentication box reappear, and the website slowly loads in the background during each cancel cycle. It seems that the 401 is not being handled correctly.

If I remove the rewriteRule block from the .htaccess file, then the authentication box works correctly on cancel - e.g. takes me to a 401 Not authorised page. However it also says:

Quote:Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I've spent days trying to figure out what is going on. All I want to achieve is that if the user clicks 'cancel' is that the website does not continue to load in the background and the authentication box does not keep reappearing and ideally (though not essential) the user is taken to a 401 page.

Any help would be really appreciated.

Many thanks

Jonathan
#2

[eluser]gojo[/eluser]
This worked for my virtually the same problem


Code:
AuthName "bobby"
AuthUserFile "/location to password here/passwd"
AuthType Basic
require valid-user

RewriteEngine on
RewriteCond %{remote_user} !^$ [nc]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]




Theme © iAndrew 2016 - Forum software by © MyBB