.htaccess:此处不允许订购

Vis*_*ngh 4 .htaccess apache2

我正在尝试将身份验证用于访问apache2中的文档根目录...这是我的配置文件

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        AccessFileName .htaccess
        DocumentRoot /home/user/workspace
        <Directory />
                Options FollowSymLinks
                AllowOverride None.htaccess
        </Directory>
        <Directory /home/vishu/workspace>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride AuthConfig
                Order allow,deny
                allow from all
        </Directory>
......
......

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这是/ home/user/workspace文件夹中的.htaccess文件:

<FilesMatch >
.....
</FilesMatch>

    AuthType Basic
    AuthName "MY ZONE"
    #AuthBasicProvider file
    AuthUserFile /home/vishu/workspace/passwordfile
    AuthGroupFile /dev/null
    Require valid-user
.....
...
Run Code Online (Sandbox Code Playgroud)

Apache .htaccess:order not allowed here出错,我从浏览器收到500错误.

elj*_*dub 6

看看你的AllowOverride指令.我也有这个问题,但以下配置对我有用:

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride AuthConfig Limit
    Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)

AllowOverride All 可能也会工作,只取决于你想要多少.

查看这两个链接以获取更多信息:

https://drupal.org/node/10133

http://httpd.apache.org/docs/2.2/howto/auth.html