我已经在.htaccess文件中实现了以下代码:
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteCond ${HTTPS} !=on
RewriteRule ^(page1\.php|page2\.php)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
这会将page1.php和page2.php重定向到https。但是,我想确保如果用户从https页面导航到任何其他页面,他们将转到http://
(而不是继续https://
)。
我怎样才能做到这一点?
任何帮助将非常感激!
您可以使用:
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteCond ${HTTPS} off
RewriteRule ^(page1\.php|page2\.php)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond ${HTTPS} on
RewriteRule !^(page1\.php|page2\.php|\.css)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句