![](/img/trans.png)
[英]Microsoft Edge PHP authentication not working without index.php in URL
[英]Bypass htpasswd authentication for url with index.php and without it
我已经使用htaccess文件添加了htpasswd保护进行身份验证,现在我想绕过www.website.com
和www.website.com/index.php
,其中两个url都访问index.php文件。 通过使用下面的htaccess文件,我已经允许index.php,我可以绕过www.website.com/index.php
网址,但不能绕过www.website.com
我的htaccess文件是:
# set an environtment variable "noauth" if the request starts with "/callbacks/"
SetEnvIf Request_URI ^/index.php noauth=1
AuthType Basic
AuthName "RESTRICTED"
#AuthName "Restricted Area"
AuthUserFile "/path/to/.htpasswd"
require valid-user
Options -Indexes
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)$ /file.php?show=all&name=$1 [L]
# Here is where we allow/deny
Order Deny,Allow
Satisfy any
Deny from all
Require valid-user
Allow from env=noauth
我相信第二个参数只使用常规正则表达式。 也许你可以让index.php可选。
SetEnvIf Request_URI "^/(index\.php)?$" noauth=1
没有测试过。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.