Combining "RewriteEngine off" AND Password Protected Directories

Permalink 1 user found helpful
Hi all!

I'm a bit stumped. On C5 sites, if I have a folder that I want to hide from the rewrite engine (say, mysite.com/desiredfolder), I make an .htaccess in the desired folder that just says:

RewriteEngine off


Works great.

Or, on non-C5 sites, when I want to easily password protect a directory via CPanel, it writes a little .htaccess for you in the desired folder:

AuthType Basic
AuthName "modulesformi"
AuthUserFile "/home/rootusername/.htpasswds/public_html/desiredfolder/passwd"
require valid-user


Also works great.

BUT, I can't seem to find a way to have them both work together. If I use the password protect folder above, it ignores the RewriteEngine off portion, whether it's before OR after the code in the example above, and leads to the broken C5 "Page Not Found" image.

How do I use CPanel's "Password Protect Directory" functionality AND stop C5 from rewriting the directory so I can actually get in there?

Thanks!

aenow
 
tdgwebteam replied on at Permalink Reply
I had the same issue, and found this worked for me:
In your htaccess file
# -- concrete5 urls start --
<IfModule mod_rewrite.c>
ErrorDocument 401 default
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/foldername/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --