Jump to content

htaccess Authentication causes 404


Phlebb

Recommended Posts

Hello,

 

Thanks in advance.

 

In my top level html directory, I use the htaccess file to push everything that is not a file or a dir through the index where I parse the URL and load the correct content.

 

AddType application/x-httpd-php .htm .html .rss
#
RewriteEngine On
Options +FollowSymlinks -MultiViews
#
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{REQUEST_FILENAME} !^THIS/ALLOWED/FILE.Jpg
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?THISALLOWEDDOMAIN\.COM [NC]
RewriteRule \.(gif|jpg|jpeg|png|swf|mp3|mid|mpg|avi|mov)$ - [F,NC]
RewriteBase /
#
DirectoryIndex index.php
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(.*)(.pdf)$
RewriteRule . /index.php [L]

In a subdirectory, I have some files that I want to PW protect. Index.html in the subdirectory just lists the files in the dir with some instructions for those that have access.

 

AddType application/x-httpd-php .htm .html
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/########/inc/.htpasswd
require user ########

DirectoryIndex index.html

 

HERE IS THE PROBLEM.

 

If I browse to the subdirectory, I am presented with the custom 404 message used in the top directory for unresolved URLs, as if the request was being processed through the top level php content system.

 

If I comment out the authentication code in the subdirectory htaccess, I get the listing of the subdirectory as expected.

 

Can someone help, please?

 

Thanks again.

 

Phlebb

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.