[英]How to force http of a single page instead of https in .htaccess
I am forcing https on all pages in my website with this code in the .htaccess 我使用.htaccess中的此代码强制在网站的所有页面上使用https
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
However I have a page videos.php which I do not want the https on, I want it to be the normal http, how do I do this? 但是我有一个我不希望使用https的页面videos.php,我希望它是普通的http,我该怎么做? Can anyone help?
有人可以帮忙吗?
Try changing the .htaccess
to 尝试将
.htaccess
更改为
RewriteEngine on
RewriteRule ^videos.php - [L,NC]
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
This will check for urls ending with videos.php
and will not do anything for those urls. 这将检查以
videos.php
结尾的网址,并且不会对这些网址做任何事情。
You can have your rules like this: 您可以具有如下规则:
RewriteEngine on
# force HTTPS for all pages except videos.php
RewriteCond %{HTTPS} off
RewriteRule !^videos\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
# force HTTP for all pages except videos.php
RewriteCond %{HTTPS} on
RewriteRule ^videos\.php$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.