Forum Moderators: phranque

Message Too Old, No Replies

2 .htaccess files

         

zlaajaa

6:21 pm on Mar 21, 2007 (gmt 0)

10+ Year Member



Hi everyone, I have one .htaccess file in root folder nad it looks like this:
RewriteEngine On
RewriteCond %{REQUEST_URI} \.zip
RewriteRule ^(.+) - [L]
RewriteRule ^(.*)$ [somesite.com...] [L]

this one redirect users to www.somesite.com. Now, I haveone folder where I want to allow users to get in but with Authorisation. I created second .htaccess file which I place in this subdirectory but something is not ok, looks like this:
RewriteEngine Off

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/some/public_html/bat/.htpasswd
AuthGroupFile /dev/null
require valid-user

If I remove Auth part, Rewrite engine is off like it should be for that folder, but with Auth part RewriteEngine Off is ignored.

so my question is how can I turn off rewrite engine and add Auth part in same .htaccess

Please help

jdMorgan

8:36 pm on Mar 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It might be easier to exclude the /bat/ subdirectory from the rule(s) in your top-level .htaccess file by adding a negative-match RewriteCond:

RewriteCond %{REQUEST_URI} !^/bat/
RewriteRule (.*) http://www.somesite.com [R=301,L]

Jim