我在其中一个 vhost 上进行了以下设置:
...<VirtualHost *:80>
ServerName cloud.domain.de
ServerAdmin webmaster@domain.de
ServerSignature Off
Alias "/.well-known/acme-challenge" "/var/www/domain.de/vh-www/htdocs/public/.well-known/acme-challenge"
<Directory "/var/www/domain.de/vh-www/htdocs/public/.well-known/acme-challenge">
Require all granted
ForceType 'text/plain'
</Directory>
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteCond %(REQUEST_URI) !/\.well\-known/acme\-challenge/?.*
RewriteCond %{HTTPS} off
# RewriteRule ^\.well-known/acme-challenge/([A-Za-z0-9-]+)/?$ - [L]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</ifmodule>...
Run Code Online (Sandbox Code Playgroud)
我想要实现的是,当http://cloud.domain.de/.well-known/acme-challenge/访问url 时,mod_rewrite 不会重写 URL 。
我已经尝试了不同的方法,其中之一是上面注释掉的 RewriteRule,但似乎没有任何效果:服务器每次都将其重写为 https。
当我出于测试目的禁用重写时,我可以很好地访问别名 URL...
如何实现不被重写的特定 URL?