apache: basic authentication before rewrite

Posted by pyro on Stack Overflow See other posts from Stack Overflow or by pyro
Published on 2010-04-09T09:53:40Z Indexed on 2010/04/11 5:53 UTC
Read the original article Hit count: 270

I have an apache in frontend that redirect a request via a rewrite rule. I have to put a basic authentication before redirect a request, so I put this in the config file:

<VirtualHost *:443>
    ServerAdmin xxxxxx
    DocumentRoot /var/www/html/
    ServerName xxxxxxx
    RewriteEngine on
    ErrorLog logs/error.log
    CustomLog logs/access_log common

    <Directory /var/www/html/>
        AuthType Basic
        AuthName "Restricted Files"
        AuthUserFile /etc/httpd/conf/tag.pwd
        Require valid-user
        RewriteRule ^/(.*) http://xxxxxx:xxx/$1   [P,L]
    </Directory>
</VirtualHost>

But doesn't work.

Any suggestions?

© Stack Overflow or respective owner

Related posts about apache

Related posts about mod-rewrite