Post by shubhamjha95 » Fri Jun 05, 2015 10:32 pm

opencart has one problem that if we open our website with WWW. than it will work Properly but if we open our website without WWW. than it will not work properly & not for all opencart user will face the same problem some of you have problem like your website will work properly without WWW. and does not work with WWW.

like my website work properly with WWW. but does not work without WWW.
see here :- www.ratlamkirana.com and ratlamkirana.com

i have asked opencart for this and i didn't get any reply ???
if you have the solution of this problem please tell us.

Newbie

Posts

Joined
Thu May 14, 2015 1:52 am
Location - Madhya pradesh, india

Post by Johnathan » Fri Jun 05, 2015 11:50 pm

You need to have the www version and the non-www version resolve the same way. This means you need to redirect the one that is not declared in the config.php file to the one that is declared.

Adding one of these two blocks of code in your htaccess should work. If it doesn't, search Google for other code snippets to use.

Code: Select all

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

Code: Select all

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

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by safa XI » Sat Jul 27, 2019 9:42 pm

I solved mine by editing config.php

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://www.my-domain.com/');
// HTTPS
define('HTTPS_SERVER', 'http://www.my-domain.com/');

User avatar
Newbie

Posts

Joined
Wed Jul 24, 2019 12:08 am
Who is online

Users browsing this forum: No registered users and 3 guests