简体   繁体   中英

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.

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.

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. I'm too much of a noob with htaccess to try and reverse engineer a solution from the bits and bobs I can find.

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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