Forum Moderators: phranque
wp/...
#htaccess of site root example.com
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.php [L]
The index.php manages all "non real" files and folders, checking the database to see if some content exists for the requested uri, if not, it gives you a custom 404 page.
Real directories and symbolic links indeed are excluded by the conditionals, but if the directory (or symlink links to a directory that) has its own htaccess that employs authentication, the conditional statement fails to recognize it as a real directory.
Here is an example I've set up. NOTE:
subdir/is a real sub directory in the site root.
#htaccess of subdir/restricted/ folder
AuthType Basic
AuthUserFile /home/..../example.com/subdir/restricted/.htpasswd
AuthName "Example Dot Com"
require valid-user
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example.com/?.*$ [NC]
RewriteRule \.(gif¦jpg¦jpeg¦png¦mp3¦mpg¦avi¦mov)$ - [F,NC]
As you can see with the restricted-symlink/ as well as the real folder subdir/restricted/ both get spit out by the custom 404 not found page. This means it must have slipped through the Rewrite Condition failing to show up as a real directory/link.
Is there a way to get around this problem?
[edited by: jdMorgan at 10:41 pm (utc) on April 1, 2007]
[edit reason] Example.com, please. See Terms of Service. [/edit]