I have two folders, F1 and F2, under my public folder, each with an .htaccess file in them. F1 is protected by basic auth in .htaccess, like this:
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/myaccount/.htpasswd
AuthGroupFile /dev/null
require valid-user
I'm rewriting a URL from F2 into F1, like this:
RewriteRule ^f2file\.php$ ../F1/f1file.php [NC,L]
This rewrite works, but it challenges me with the basic auth I have set up in F1. Is there a way to either send basic auth credentials with the rewrite, or to bypass the basic auth when rewriting from a local folder?
I've tried setting an environment variable like in this question:
SetEnvIf Request_URI ^f2file\.php$ ADD_BASIC_AUTH
RequestHeader set Authorization "Basic XXXXXXXX" env=ADD_BASIC_AUTH
Where XXXXXXXX is the base 64 encoded value of user:pass as described in the above question. But, this doesn't work, it still challenges me for the credentials, maybe because I'm not doing the rewrite as a proxy? Any ideas? Thanks!