开发者

Password protect all sub-domains

I have several sub-domains all pointing to same directory in webroot. I want to passsword protect all sub-domains using .htaccess.

    AuthUserFile /etc/httpd/passwd/.htpasswd
    AuthType Basic
    AuthName "Yet to release"
    Require valid-user 

When this snippet is put in .htaccess it doesn't work, but it works fine when I put this 开发者_JAVA技巧in each of the virtual host setup for each sub-domain. I don't want to put this for all sub-domains and then remove later. Is there a way to protect all sub-domains at one go.

Thanks


The directory you are placing this .htaccess file in might not have Options and AllowOverride privledges set...

Place your .htaccess file into the directory that is root to all your subdomain DocumentRoot directories.

Then edit your httpd.conf file:

<Directory "/path/to/that/.htaccess/directory">
  Options All
  AllowOverride All
  order allow,deny
  allow from all
</Directory>

Retart Apache.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜