AbanteCart Community

eCommerce construction => How-to questions => Topic started by: Baychaser on April 06, 2023, 09:53:54 PM

Title: how to redirect http and www to https
Post by: Baychaser on April 06, 2023, 09:53:54 PM
Can anyone tell me how can I how to redirect http and www to https. I want to make sure when bargainlanes.com is typed to redirect to https. I did a store setup with correct https info and this is what I have in my "htaccess.txt" file and it's still not working, is it supposed to end with ".txt" or do I have to change it to "htaccess" only

It works normally when I click any link on site and it Will switch back to https

Title: Re: how to redirect http and www to https
Post by: Basara on April 07, 2023, 02:21:39 AM
Hello.
Your need to rename the .txt file to .htaccess

You can try something like this example
Code: [Select]
# SEO URL Settings
RewriteBase /
#http-https
RewriteCond %{HTTPS} !on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#www force
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#all other rules below

https://stackoverflow.com/a/28831015
Title: Re: how to redirect http and www to https
Post by: Baychaser on April 07, 2023, 07:15:49 AM
Yep that did the trick, thak you.