Htaccess that requires auth and passes auth to PHP script

From Stack Overflow
Jump to: navigation, search
AuthType Basic
AuthName Private
AuthUserFile /var/www/data/somefile.htpasswd
AuthGroupFile /dev/null
Satisfy All
<Limit GET POST>
Require valid-user
</Limit>

RewriteEngine on
RewriteCond %{HTTP:Authorization} !^$
RewriteCond %{QUERY_STRING} !auth=
RewriteRule (.*) %{REQUEST_URI}?%{QUERY_STRING}&auth=%{HTTP:Authorization}&authuser=%{REMOTE_USER} [L]
Personal tools