Home > Latest Joomla 1.5 Tutorials > Joomla - htaccess > non-www to www redirect

Redirect from non-www to www URL

A very important aspect of search engine optimization is duplicate content.  When you have a site.com and a www.site.com you in effect have duplicate content.  This isn't quite the issue it used to be but it is still good practive to settle on one or the other- www being the most popular.

So when a user types in trainmejoomla.com we want the address bar in the browser to redirect the user to www.trainmejoomla.com.  Doing this is simple.  Enter the code below after the Rewrite Engine:on in the .htaccess file on the root of your website directory.

# non-www to www redirect
rewritecond %{http_host} ^yourwebsite.com
rewriterule ^(.*)$ http://www.yourwebsite.com/$1 [r=301,nc]

 
Newsletter

login joomla
Newsflash

Joomla Website Hosting.

www.GoDaddy.com

I use GoDaddy for my Joomla hosting. It is especially easy if you have multiple sites that you need to maintain. Their Hosting Connection platform allows you to easily install and uninstall programs - one of which is Joomla 1.5. It also allows you to upgrade your installations with the click of a button.