htaccess密码保护不适用于url

时间:2018-12-21 10:36:40

标签: .htaccess web passwords

我正在尝试使用htacess在所有具有leden/的页面上使用此代码添加密码:

RewriteEngine on
DirectoryIndex
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]

#Indexes uitzetten
Options -Indexes

#Cross site access toestaan
Header set Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"

#CMS rewrite
RewriteRule ^cms/$ /cms/administrator [L]

#mysitename

DirectoryIndex index.php

SetEnvIf Request_URI ^leden/(.*).html auth=1

AuthName "Please login"
AuthType Basic
AuthUserFile "/home/mysitename/public_html/.htpasswd"

# first, allow everybody
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auth

RewriteRule         ^leden/(.*).html catlisting.php?alias=$1 [QSA,L]
RewriteRule         ^info/(.*).html catlisting.php?alias=$1 [QSA,L]
RewriteRule         ^events/(.*).html events.php?alias=$1 [QSA,L]
RewriteRule         ^projecten/(.*).html projecten.php?alias=$1 [QSA,L]
RewriteRule         ^product/(.*).html product.php?alias=$1 [QSA,L]
RewriteRule         ^catalogus/(.*).html catalogus.php?alias=$1 [QSA,L]
RewriteRule         ^(.*).html content.php?alias=$1 [QSA,L]

ErrorDocument 404 /error/404.php
ErrorDocument 403 /error/403.php
ErrorDocument 500 /error/500.php
ErrorDocument 501 /error/501.php
ErrorDocument 503 /error/503.php
ErrorDocument 504 /error/504.php

但是例如,我进入https://mysite.nl/leden/vergaderstukken.html时,看不到任何密码弹出窗口。为什么?我在做什么错了?

0 个答案:

没有答案