如果不是 xml 文件并且请求 URI 中不包含显示,htaccess 将重写为 https

htaccess rewrite to https if not xml file and not containing display in request URI

如何为非 xml 文件请求以及当请求 URI 不包含字符串“display”?

创建 htaccess 重写规则到 https

我尝试了以下方法,但这不起作用:

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !xml [NC,OR]
RewriteCond %{REQUEST_URI} !display [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

谢谢。

使用:

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !xml [NC]
RewriteCond %{REQUEST_URI} !display [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]

因为它是AND而不是OR