PDA

View Full Version : multiple .htaccess files


hodgy
July 22nd, 2004, 02:17 PM
I have a .htaccess file in my root folder which defines the error pages and does some permanent redirecting but does not have any password protection, i wish to now put a new .htaccess file in a sub-directory so that only this sub-part of my website requires a password. from everything i've read this is a simple process and requires me to only put in a new .htaccess file in the subdirectory and an .htpasswd file also with the required content but it refuses to work. what am i missing ???

degsy
July 22nd, 2004, 04:54 PM
Welcome :)

Can you post the path of your webserver and the locations and contents of your htaccess file and htpasswd file.

hodgy
July 22nd, 2004, 05:21 PM
ErrorDocument 401 /error.php
ErrorDocument 402 /error.php
ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php

RedirectMatch permanent ^/studies/power-lines/ http://www.greenfacts.org/power-lines/index.htm
RedirectMatch permanent ^/studies/endocrine_disruptors/ http://www.greenfacts.org/endocrine-disruptors/index.htm
RedirectMatch permanent ^/studies/dioxins/ http://www.greenfacts.org/dioxins/index.htm

this is the contents of the htaccess file in /html/

now, in /html/atsdr/
there is:

AuthUserFile /html/.htpasswd
AuthName "Protected Access"
AuthType Basic
<LIMIT GET POST>
Require valid-user
</LIMIT>

Please Note - when i delete the htaccess in the root, the login and pass works fine for the sub-directory htaccess, but when its there, it no longer works, which i find extremely frustrating as there is nothing in the root htaccess file about authorisation !
grrrrrrrrrrrrrrrrrrrrrrrrrrrrr

degsy
July 22nd, 2004, 05:30 PM
Strange.

by doesn't work are you meaning that the Password box does not appear?


I can't see anything there to stop it working.

hodgy
July 23rd, 2004, 08:07 AM
by not work i mean when i try and access that directory i get an error and therefore the error page that i have defined in the first htaccess files comes up....deadline is this afternoon, if i dont get it done i'll have to do it in javascript which isn't ideal.

renegade600
July 23rd, 2004, 09:30 AM
I may be misunderstanding what you need but does your hosting service not give password protected folders for your site? or is this not what you need?

hodgy
July 23rd, 2004, 10:43 AM
thanks for suggestions, found the problem and solved it now though, for those who find themselves in similar situations in the future the problem came from defining my own custom error pages. Being thorough i defined custom pages for all the errors (401-402-403-404-500) even though i knew most of these very rarely come up. The problem is that the 401 error is the "Authorisation required" error and as this command was in the .htaccess file in the root it was in effect rendering the .htaccess file in the sub-directory useless. Lesson learnt.

degsy
July 23rd, 2004, 04:33 PM
Thanks for the update :)

Still strange as I too have a .htaccess in the root defining custom error pages and my Authentication still works.

verystumped
September 8th, 2004, 03:58 PM
I hope someone can help with this. I'm using .htacess to password a directory on a website and though I do get the 401 error page, I don't get the password box popup. Can anyone explain why this might be happening?

I contacted the web host and they say the popup box is working when they try so I've disabled my firewall, antivirus and checked my Web surf settings and still it doesn't popup for me.

Please Help!! I've got to get this site up and working soon.

degsy
September 8th, 2004, 04:18 PM
Welcome :)

try clearing your internet cache.

If the file is stored locally then you will not get the password box.

verystumped
September 8th, 2004, 04:18 PM
I just found the problem. It's MICROSOFT! I hate MS stuff.

I've just tried the pages in Opera and Mozilla and the popup pops up. Now, does anyone know what it is with MSIE 6.0 that I need to fix/change to allow the popups? I can use another browser, no problem, but I'd like to put an addditional message on my 401 page to help users with MSIE if they don't get the popup box.

degsy
September 8th, 2004, 04:28 PM
Welcome :)

try clearing your internet cache.

If the file is stored locally then you will not get the password box.
Did you try that?

Also try a hard refresh.
Load the page then use CTRL+Refresh