Phlebb Posted April 29, 2008 Share Posted April 29, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/103404-htaccess-authentication-causes-404/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.