I have changed config file in opencart from http://mywebsite.in/ to http://www.mywebsite.in/ .
Now the problem is when i visit mywebsite.in, the website doesn't work. How can i redirect to www or http.
do i need to do something in library/url.php
public function link($route, $args = '', $secure = false) { if ($this->ssl && $secure) { $url = 'https://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\') . '/index.php?route=' . $route; } else { $url = 'http://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\') . '/index.php?route=' . $route; }
if ($args) {
if (is_array($args)) {
$url .= '&' . http_build_query($args);
} else {
$url .= str_replace('&', '&', '&' . ltrim($args, '&'));
}
}
Please help me. Thanks alot in advance.
Aditya, You need to make .htaccess file in root folder and then do following changes on that file.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mywebsite.in$
RewriteRule (.*) http://www.mywebsite.in/$1 [R=301,L]
It will forcefully redirect to www. If it's work then give me whote.