简体   繁体   English

将单个页面从HTTPS重定向到HTTP

[英]Redirect a single page from HTTPS to HTTP

I have a site that fully runs on HTTPS. 我有一个完全在HTTPS上运行的网站。 And there is a file that does not need to be loaded in HTTPS. 并且有一个文件不需要在HTTPS中加载。 Therefore I tried to redirect it from htaccess but it didnt work. 因此,我尝试将其从htaccess重定向,但没有成功。

RewriteCond %{HTTPS} on
RewriteRule ^xml$ http://mysite/api.php [L,R=301]

Here are the lines I tried but they did not work. 这是我尝试过的线,但是它们没有用。

I tried this also but negative. 我也尝试过但是负面的。 HTTPS to HTTP htaccess redirect for home page only HTTPS到HTTP htaccess重定向仅用于主页

you could just use a simple 301 redirect. 您可以只使用一个简单的301重定向。 Just put this in your .htaccess 只需将其放入您的.htaccess中

redirect 301 /api.php http://mysite/api.php

That should work becuase it's just taking the api.php file on either https or http and telling it to go to 那应该起作用,因为它只是将api.php文件放在https或http上,并告诉它去

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

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