目前在ubuntu上的apache服务器上运行站点,现在整个站点都受到.htaccess身份验证的保护。
想做:我需要在没有身份验证的情况下允许两个URL。
sites1.conf
<VirtualHost *:80>
...
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(tools|manager)/
</VirtualHost>
<Directory /srv/site1/symfony/>
AuthType Basic
AuthName "My Area"
AuthBasicProvider file
AuthUserFile "/etc/apache2/passwords.htpwd"
Require user user1
SetEnvIf Request_URI ^/en/App/uploadImagesForm allow
Order allow,deny
Allow from env=allow
Satisfy any
</Directory>
网址:xxx.xxxx.xx:9005 / en / App / uploadImagesForm /
问题仍在询问密码
答案 0 :(得分:0)
您可以禁用整个目录的身份验证
<Directory "/srv/site1/symfony/public">
AuthType None
Require all granted
</Directory>
要仅允许特定URI,请将以下代码添加到VirtualHost配置中。
<Location "/en/App/uploadImagesForm">
AuthType None
Require all granted
</Location>
查看Apache Sections配置文档以获取更多详细信息:http://httpd.apache.org/docs/current/sections.html#file-and-web