我有以下的Apacheconfiguration:
<VirtualHost *:80> Alias "/.well-known" "/var/www/example.com/.well-known" RewriteEngine On <If "%{HTTP_HOST} == 'example.com'"> RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </If> <ElseIf "%{HTTPS} != 'on'"> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </ElseIf> </VirtualHost>
我希望Alias
免于HTTPSredirect,即http://example.com/.well-known/x
应该返回/var/www/example.com/.well-known/x
文件。 目前,它正在通过下面的RewriteRules
redirect到HTTPS。
我怎样才能使Alias
免受redirect?
<If "%{HTTP_HOST} == 'example.com' && !(${REQUEST_URI -strcmatch '/.well-known/*')" > RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </If> <ElseIf "%{HTTPS} != 'on' && !(${REQUEST_URI -strcmatch '/.well-known/*')"> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </ElseIf>