I have several WordPress staging sites placed in a staging directory. The staging directory holds a .htaccess and .htpasswd
.htaccess:
AuthType Basic
AuthName "restricted area"
AuthUserFile /var/www/staging/.htpasswd
require valid-user
.htpasswd
username:PdadsaasdMehzdsadwad
When I place a file in this directory, the authentication process triggers appropriately, however when I place a WordPress site in the subdirectory, the authentication is not showing.
Example WP site: /var/www/staging/some-wp-site
.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
WP Site Vhost:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName somewpsite.com
ServerAlias somewpsite.com
DocumentRoot /var/www/staging/some-wp-site
<Directory />
AllowOverride All
</Directory>
<Directory /var/www/staging/some-wp-site>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
my apache.conf
<Directory /var/www/staging>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
I suspect I need to modify the vhost to use the authentication, however since I have quite a few sites in that directory I would prefer if there was a globl rul that simply triggers for any files placed in this subdirectory, no matter what another configuration says. Is this possible?