How to Redirect non-www to www in opencart

April 5, 2018 - By 
All ProblemsCategory: frontendHow to Redirect non-www to www in opencart
kathyfitts asked 6 months ago

How to redirect non-www to www
I’m using SSL also
I’m using opencart 3.0.2.0
I want to redirect
sitename.com
http://www.sitename.com
http://sitename.com
http://www.sitename.com

to

https://www.sitename.com
https://sitename.com

1 Answers
Laxmi Kant answered 6 months ago

You can easily redirect using htaccess file by writing code given below
# Redirect to www RewriteCond 
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Posted In:  
  comments