Cur*_*ker 36
我在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]
Run Code Online (Sandbox Code Playgroud)
该RewriteCond %{HTTPS} on部分可能不适用于所有Web服务器.RewriteCond %{HTTP:X-Forwarded-SSL} on例如,我的webhost需要.
如果您想强制反向,请尝试:
#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]
Run Code Online (Sandbox Code Playgroud)
如果您想要一些其他方法,请查看askapache.
Wil*_*III 15
这应该适用于几乎所有场景,并且应该在您的实际vhost或.htaccess中工作:
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}/%{REQUEST_URI} [R=301,L]
Run Code Online (Sandbox Code Playgroud)
(不要忘记%{REQUEST_URI}之前的斜杠,因为这可能允许传递一个portnumber,这很危险)
RewriteEngine on
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{SERVER_NAME}/%{REQUEST_URI} [R=301,L]
Run Code Online (Sandbox Code Playgroud)
我在loadballancer背后遇到了一些问题.这是我如何解决它.
| 归档时间: |
|
| 查看次数: |
71691 次 |
| 最近记录: |