I have changed config file in Opencart from http://example.in/
to http://www.example.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, '&'));
}
}
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.