简体   繁体   English

HTTPS到HTTP htaccess重定向仅用于主页

[英]HTTPS to HTTP htaccess redirect for home page only

I need help being able to redirect the home page of a website I'm building from HTTPS to HTTP. 我需要能够将我正在构建的网站的主页从HTTPS重定向到HTTP的帮助。

The website I'm building is using cart 66 and unfortunately when the site redirects back to the home page after visiting the secure cart pages it stays in HTTPS and certain elements of the front page no longer display correctly. 我正在构建的网站正在使用购物车66,但是不幸的是,当该网站在访问安全购物车页面后重定向回首页时,它停留在HTTPS中,并且首页的某些元素不再正确显示。

I assume doing a redirect will be the best option to solve this problem. 我认为进行重定向将是解决此问题的最佳选择。 Although I'm open to other suggestions. 尽管我愿意接受其他建议。

I've searched for solutions online, but I can only find redirects from HTTPS to HTTP for the whole site, not just a single page or the opposite of what I'm trying to do. 我已经在网上搜索解决方案,但是我只能找到整个网站从HTTPS到HTTP的重定向,而不仅仅是单个页面或与我尝试做的相反的事情。 I'm too much of a noob with htaccess to try and reverse engineer a solution from the bits and bobs I can find. 我对htaccess实在是个菜鸟,无法尝试使用我能找到的零碎的东西对它进行反向工程。

I'd also like to leave the option of adding more than one page to the redirect just in case I discover any more pages that end up appearing broken. 我还想保留将多个页面添加到重定向中的选项,以防万一我发现任何其他最终显示为残破的页面。

Any help is greatly appreciated. 任何帮助是极大的赞赏。

As suggested on apache wiki: 如在apache Wiki上建议的:

http://wiki.apache.org/httpd/RewriteHTTPToHTTPS http://wiki.apache.org/httpd/RewriteHTTPToHTTPS

you could use: 您可以使用:

RewriteEngine On
# This will enable the Rewrite capabilities

RewriteCond %{HTTPS} on
# This checks to make sure the connection is HTTPS

RewriteRule ^/?homepage\.html http://%{SERVER_NAME}/homepage\.html [R,L]

changing homepage.html to your home page name. 将homepage.html更改为您的主页名称。

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

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