简体   繁体   English

仅在一个页面中将http重定向到https,其他页面将https重定向到http

[英]Redirect http to https only in one page and the others pages https to http

I want redirect some pages from http to https (The pages with forms and login page) and the others pages, https to http. 我想将某些页面从http重定向到https(带有表单和登录页面的页面),而将其他页面从https重定向到http。

How I do without write all rules for every page? 我如何不为每个页面编写所有规则?

You can use the following in /root.htaccess : 您可以在/root.htaccess中使用以下命令:

RewriteEngine on

#redirect /login from http => https#
RewriteCond %{HTTPS} off
RewriteRule ^login https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]
#redirect any other request excluding /login from https to http#
RewriteCond %{HTTPS} on
RewriteRule !^login http://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM