0

My Website (opencart) works great on mywebsite.com but i got problems when trying www.mywebsite.com,

eg: icons on header and products disappear.

I tried to add a line on config.php:

<?php
// HTTP
define('HTTP_SERVER','http://mywebsite.com/');


// HTTPS
define('HTTPS_SERVER', 'http://mywebsite.com//public_html/');


// DIR
define('DIR_APPLICATION', '/home/XXXX/public_html/catalog/');
define('DIR_SYSTEM', '/home/XXXX/public_html/system/');
define('DIR_DATABASE', '/home/XXXX/public_html/system/database/');
define('DIR_LANGUAGE', '/home/XXXX/public_html/language/');
define('DIR_TEMPLATE', '/home/XXXX/public_html/view/template/');
define('DIR_CONFIG', '/home/XXXX/public_html/system/config/');
define('DIR_IMAGE', '/home/XXXX/public_html/image/');
define('DIR_CACHE', '/home/XXXX/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home/XXXX/public_html/download/');
define('DIR_LOGS', '/home/XXXX/public_html/system/logs/');

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'XXXX_com1');
define('DB_PASSWORD', 'XXXXXXXXX');
define('DB_DATABASE', 'XXXX_com1');
define('DB_PREFIX', 'oc_');?>

define('HTTP_SERVER','http://www.mywebsite.com/');

under

define('HTTP_SERVER','http://mywebsite.com/');

nothing happened.

i'm beginner on opencart, How can I solve this ?

1 Answers1

0

Opencart only works over 1 url,

You have never been a opencart website working with two different url, to fix that your will have to include the following in your htaccess.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourDomain\.com
RewriteRule (.*) http://yourDomain.com/$1 [R=301,L]

This code redirect, all urls with www to urls without www. This fix your problem.

The source

ber2008
  • 323
  • 3
  • 10
  • Hi, Thanks a lot for your answer ... but it didn't work with me , i still have the same problem :( – Jason Statham Black Lion Mar 25 '15 at 12:22
  • Hi, Thanks for your answer, but I think, It's not posible that you have the same problem if you don't use this kind of url www.mywebsite.com If you uses the code you website never go to www.mywebsite.com You will go to http://mywebsite.com and this kind of url don't have any problem in your comment. Rename the htaccess to ".htaccess" and include the code with your urls Regards, – ber2008 Mar 25 '15 at 13:36