Post by dsb802 » Mon Feb 12, 2018 2:35 pm

Hi,
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]
I've tried below in OpenCart .htaccess but it is not working:

Code: Select all

RewriteCond %{HTTP_HOST} ^gethappythoughts.org/shop/$
RewriteRule (.*) http://www.gethappythoughts.org/shop/$1 [R=301,L] 
Issue with the following code is if anyone accesses my shop without www then it redirects visitors to the main site

Code: Select all

# Redirect non-www urls to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Please help

Newbie

Posts

Joined
Fri Mar 02, 2012 3:25 pm

Post by rjcalifornia » Thu Apr 12, 2018 7:37 pm

dsb802 wrote:
Mon Feb 12, 2018 2:35 pm
Hi,
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]
I've tried below in OpenCart .htaccess but it is not working:

Code: Select all

RewriteCond %{HTTP_HOST} ^gethappythoughts.org/shop/$
RewriteRule (.*) http://www.gethappythoughts.org/shop/$1 [R=301,L] 
Issue with the following code is if anyone accesses my shop without www then it redirects visitors to the main site

Code: Select all

# Redirect non-www urls to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Please help
That's strange. Did you try to use this code:

Code: Select all

# Redirect non-www urls to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
In the htaccess of WordPress?

Image


Active Member

Posts

Joined
Fri Sep 02, 2011 1:19 pm
Location - Worldwide

Post by dsb802 » Thu Jun 21, 2018 8:42 pm

Hi,
Thanks for the reply
Yes it is already there but still not working

Newbie

Posts

Joined
Fri Mar 02, 2012 3:25 pm

Post by ravikumar22 » Thu Jun 21, 2018 9:05 pm

dsb802 wrote:
Thu Jun 21, 2018 8:42 pm
Hi,
Thanks for the reply
Yes it is already there but still not working
Hi Please see these my two articles. maybe it can help you.
https://thephpfreelancer.blogspot.com/2 ... using.html
https://thephpfreelancer.blogspot.com/2 ... rt-in.html
let me know if you still not able to make this.
I will help you :)
For Quick Professional Support Contact: ravikumar1986ravi@gmail.com
Image

User avatar
New member

Posts

Joined
Sun Apr 12, 2015 6:33 am

Post by dsb802 » Fri Jun 22, 2018 3:34 pm

Hi,

Thanks for your reply. the above steps are already done by me but no fix

Newbie

Posts

Joined
Fri Mar 02, 2012 3:25 pm

Post by IP_CAM » Sun Jun 24, 2018 1:16 am

Well, that rewrite code, shown above, would not have worked anyway, since
your site works under HTTPS. Still, you have mixed http + https links
in your Pages, as you can see on the image below. And most of the common + popular
.htaccess-based Rewrite https / www Routines are unable, to handle such,
especially, if remote/subdomain linkings (images/scripts/fonts/styles) are part of it.
And if you also use WP on the same Server, or even in the Site ROOT, it could even get
worse ... ( But someone already offered some paid support, I would think about it... ;) )
Good Luck
Ernie
---
Image

Attachments

mixed_linking_disables_htaccess_function.jpg

mixed_linking_disables_htaccess_function.jpg (100.37 KiB) Viewed 244 times


For Sale: Top URL's, including OpenCart V-Pro installed, like seen here:
http://www.bigmax.ch - http://www.ipcam.li - http://www.opencart.li
For Information + URL's offered, please contact me at: jti@jacob.ch
I am NOT available for Custom Support in existing OC Installations!
My Github Repositories: https://github.com/IP-CAM
Image


User avatar
Guru Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: dani888, OSWorX and 13 guests