Showing posts with label awesome icons. Show all posts
Showing posts with label awesome icons. Show all posts

How to redirect non-www URLs to www Opencart



How to redirect non-www URLs to www?

Redirecting Non WWW to WWW :

Why we do this, sometimes we using images /icons from other websites i.e awesomeicons etc, so if we access our website without www the icons not showing. This is one of the reason we use redirects.

  1. Create a .htaccess in the root of your website. Put the following code, save it.

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


  1. Goto config.php on your opencart main directory and in admin directory too.

Add www before your domain name. 
config.php


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

// HTTPS
define('HTTPS_SERVER', 'http://www.velsat.com/');

config.php/ Admin

<?php
// HTTP
define('HTTP_SERVER', 'http://www.velsat.com.my/adminx/');
define('HTTP_CATALOG', 'http://www.velsat.com/');

// HTTPS
define('HTTPS_SERVER', 'http://www.velsat.com/admiz/');
define('HTTPS_CATALOG', 'http://www.velsat.com/');

you are DOne..!

But wait did you check your admin Panel, may be it won't work because of the session

what you do it just Remove www from the admin Config.php file. 

Enjoy.