force one page to use HTTPS and the others to use HTTP with .htaccess

妖精的绣舞 提交于 2020-01-05 09:30:50

问题


I am trying to force one page to always use https it is not working

The url http://www.example.com/bookings/

and the .htaccess that I have

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^bookings$ https://www.example.com/bookings [L,R=301]

回答1:


Try this rule as your very first rule in your root .htaccess:

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^bookings/?$ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,NE,NC]


来源:https://stackoverflow.com/questions/27530010/force-one-page-to-use-https-and-the-others-to-use-http-with-htaccess

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!