Reputation: 13
The problems are like
http://www.example.com
: It works fine.https://www.example.com
: It works fine with my www ssl certificatehttp://example.com
: I lose my styles and icons.https://example.com
: I lose my styles and icons.Now I want it in these ways :
http://example.com
: It should redirect to https://www.example.com
http://www.example.com
: It should redirect to https://www.example.com
.example.com
: It should redirect to https://www.example.com
Here is my current .htaccess.txt
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Please direct me how I can achieve what I want and how to fix styles and icons problem. Thanks in Advance !
Upvotes: 0
Views: 634
Reputation: 183
Check the below code inside htaccess
:
RewriteCond %{HTTPS} off
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Upvotes: 2