This is the regular TYPO3 RealURL .htaccess in a nutshell, situated in public_html
:
# * BASIC TYPO3 URL REWRITING *
# -----------------------------
RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php
It will redirect incoming links that do not start with typo3, that are not files, directories or symlinks to the central entry point index.php.
Now we have a .htaccess/httpauth protected directory called public/user_upload/myDir
.
Its .htaccess file contains only the following lines:
AuthUserFile "/home/user/.htpasswds/public_html/fileadmin/user_upload/myDir/passwd"
AuthType Basic
AuthName "Please authenticate"
require valid-user
Accessing a file www.mysite.com/public/user_upload/myDir/myfile.pdf
from that directory is impossible as long as the main .htaccess redirections are enabled.
Instead of displaying the httpauth-login-dialogue, which is the desired outcome, the RewriteRule to index.php still applies.
So I would like to exclude that directory from rewriting, by adding the following line:
# * BASIC TYPO3 URL REWRITING *
# -----------------------------
RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]
// stop rewriting if myDir is accessed
RewriteRule ^public/user_upload/myDir/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php
Sounds good, but doesn't work. The Rewriting still goes to index.php. What could be the reason?
It's as if !-d
couldn't detect the directory. Maybe because it's protected?