Redirect non-www to www

Permalink
hey guys,
i was wondering if it is possible to redirect non-www URL to www URL the C5 way for better SEO.

i tried adding these lines into .htaccess:

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

But it generated error that says:

"This webpage has a redirect loop."

Any solution is gratefully appreciated. Thanks

astrosurge
 
synlag replied on at Permalink Reply
synlag
This should work without a rewrite rule if your server is configured correctly.

Make sure you have set

...
define('BASE_URL', 'http://www.yourdomain.com');
...

in config/site.php

--ron
astrosurge replied on at Permalink Reply
astrosurge
hey that worked!
thanks!!
michaelmowry replied on at Permalink Reply
In 5.7 would the change below be made in the application/config/app.php file?

...
define('BASE_URL', 'http://www.yourdomain.com');
...