【发布时间】:2017-05-31 10:53:11
【问题描述】:
我的网站启用了 HTTPS,并且所有页面都使用 仅使用 HTTPS。客户现在需要将静态页面(如 about-us、termsofus)显示为 HTTP 页面而不是 HTTPS。这意味着即使用户尝试以 HTTPS 方式打开 about-us 页面,它也应该重定向到 about-us 的 HTTP 版本。
我的.htaccess代码如下:
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteCond %{HTTPS} off
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^\/about-us
RewriteCond %{REQUEST_URI} !^\/termsofus
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} \/about-us [OR]
RewriteCond %{REQUEST_URI} \/termsofus
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</IfModule>
问题:每当我打开 HTTP/HTTPS 版本的 about-us 页面时,它都会不断将我重定向到 index.php。
例如:https://example.com/about-us 到 https://example.com/index.php
本站使用 PHP YII 框架。
【问题讨论】: