更新时间:2023-08-18 17:05:46
我在 wordpress 的 admin 文件夹中使用了类似的东西:
I use something similar to this for my admin folder in wordpress:
#redirect all https traffic to http, unless it is pointed at /checkout
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/checkout/?.*$
RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L]
RewriteCond %{HTTPS} on
部分可能不适用于所有网络服务器.例如,我的虚拟主机需要 RewriteCond %{HTTP:X-Forwarded-SSL} on
.
The RewriteCond %{HTTPS} on
portion may not work for all web servers. My webhost requires RewriteCond %{HTTP:X-Forwarded-SSL} on
, for instance.
如果您想强制反向,请尝试:
If you want to force the reverse, try:
#redirect all http traffic to https, if it is pointed at /checkout
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/checkout/?.*$
RewriteRule ^(.*)$ https://mydomain.com/$1 [R=301,L]
如果您想要一些替代方法,请查看 问阿帕奇.
If you want some alternate ways to do it, check out askapache.