Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: how to redirect http and www to https  (Read 2139 times)

Offline Baychaser

  • Newbie
  • *
  • Posts: 37
  • Karma: +4/-0
    • View Profile
how to redirect http and www to https
« 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

« Last Edit: April 06, 2023, 10:28:17 PM by Baychaser »

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5723
  • Karma: +271/-2
    • View Profile
Re: how to redirect http and www to https
« Reply #1 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

Offline Baychaser

  • Newbie
  • *
  • Posts: 37
  • Karma: +4/-0
    • View Profile
Re: how to redirect http and www to https
« Reply #2 on: April 07, 2023, 07:15:49 AM »
Yep that did the trick, thak you.

 

Powered by SMFPacks Social Login Mod