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
https://forums.phpfreaks.com/topic/103404-htaccess-authentication-causes-404/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.