我有如下所示的 .htaccess 文件,用于对我的所有页面强制使用 https。
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?example\.net
RewriteRule ^(.*)$ https://www.example.net/$1 [R,L]
它按照我的要求工作正常。现在我想为我的一个名为 demo.html 的页面排除 https 我不想要 https。 它的需要
http://example.net/demo.html
而不是
https://example.net/demo.html
最佳答案
您需要为其添加RewriteCond
条件。
检查以下代码:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?example\.net
RewriteCond %{REQUEST_URI} !^/demo\.html$ [NC]
RewriteRule ^(.*)$ https://www.example.net/$1 [R,L]
关于php - 将一页重定向到 http 而不是 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54453439/