从http永久重定向到https页面 [英] Permanent redirect from http to https page
本文介绍了从http永久重定向到https页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试创建使用.htaccess从HTTP页面重定向到HTTPS页面(仅针对特定页面)的规则时,我收到了循环重定向。我在哪里错了?
When I try to create rules for redirect from HTTP pages to HTTPS pages (only for specific pages) with .htaccess, I've received loop redirect. Where am I wrong?
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} ^(/doctor) [NC, OR]
RewriteCond %{REQUEST_URI} ^(/client)
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^(/doctor) [NC, OR]
RewriteCond %{REQUEST_URI} !^(/client)
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L]
推荐答案
我找到了我的问题的答案:
I've found answer to my question:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} ^(/(client/|doctor/))
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^(/(client/|doctor/))
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
这篇关于从http永久重定向到https页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文