Forum Moderators: phranque
you recently helped me out with a problem which i had in this thread [webmasterworld.com...] Where i wanted to redirect all traffic to another site vai a 301 except to allow me access to the admin folder on that site.
What I would like to do is add password protection to the admin folder that I wanted access to.
What I have found is that if I create a htaccess file in this folder then I get a 404 when trying to access it.
The code I have in the htaccess in the root of the site is
Options All -Indexes
#
RewriteEngine On
#
RewriteCond %{REQUEST_URI}!^/admin/
RewriteRule (.*) http://www.example.com/$1 [R=301,L] and all works fine until I put a htaccess file in the admin folder when I get the 404. If I delete this file then all works ok, but the admin is unprotected.
The code in the htaccess in the admin folder is
AuthType BasicAuthName "Restricted Area"
AuthUserFile "/home/mysite/.htpasswds/example/admin/passwd"
require valid-user
Any ideas?
Thanks
stubbsy
In the second .htaccess:
RewriteEngine on
RewriteOptions inherit
OR
Adjust the rule you need to work in the directory you are working in, and add it to the lower level .htaccess
EG if you have this in the root and your directory is called 'yourdirectory'
RewriteRule ^yourdirectory/youpage\.ext$ /do/something.ext [L]
You would use this in the lower level:
RewriteRule ^youpage\.ext$ /do/something.ext [L]
Hope this helps.
Justin
Wish I could be more help, but will defer to someone with better knowledge of how the two interact.
Justin