1

I have multiple vhosts in my httpd.conf like this:

 <VirtualHost *:80>
    ServerName example.com
    DocumentRoot "/var/www/html/wordpress"
    <Location /wp-admin/>
            AuthName "Just What Do Youuu Think You're Doing?"
            AuthUserFile /etc/httpd/.htpasswd
            AuthType basic
            require valid-user
    </Location>
...
</VirtualHost>

<VirtualHost *:80>
        ServerName coolsite.example.com
        DocumentRoot "/var/www/html/coolsite/public"

        <Location /*>
                AuthName "Just What Do Youuu Think You're Doing?"
                AuthUserFile /etc/httpd/.htpasswd
                AuthType basic
                require valid-user
        </Location>
...
</VirtualHost

The first site is a WordPress - where the .htpasswd is meant to protect just the admin section. The second is a Laravel - where the entire site is meant to be protected (Location /*).

The first virtual host works as intended, but the second one will continually redirect me to the htpasswd sign on screen - even when my credentials are correct... is this a common issue if I use the same htpasswd file for multiple vhosts? Why else could this be the case?

If I remove the <Location /*> from the second vhost I can access it fine... just a bit confused. The password is definitely right as it works on the first vhost.

Summer Developer
  • 160
  • 1
  • 13

0 Answers0