I've installed WordPress in main directory of my site and OpenCart in sub-folder of my site /shop/
Now I want to redirect non www to with www
My main site URL is https://www.gethappythoughts.org/
Opencart URL is - https://www.gethappythoughts.org/shop/
I've tried adding several codes in OpenCart .htaccess and WordPress .htaccess to make it possible but not able to achieve it.
Please help me
Config - URL in my shop/config file and shop/admin/config file is with www
OpenCart .htaccess:
Code: Select all
RewriteEngine On
RewriteBase /shop/
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) 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]
Code: Select all
RewriteCond %{HTTP_HOST} ^gethappythoughts.org/shop/$
RewriteRule (.*) http://www.gethappythoughts.org/shop/$1 [R=301,L]
Code: Select all
# Redirect non-www urls to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]