Joomla Redirects PDF Print E-mail
Written by Fr. Robert Bower   
Monday, 10 May 2010 21:46

As you may have found out many hosting companies will allow you to a access your site with the URL of http://www.yoursite.com or http://yoursite.com.  This feature often makes search engines  and reporting tools think you have two identical sites rather then one site resulting in penalties from the search engines and separate reports for your site from your reporting tool.  A quick edit of your .htaccess file for your Joomla site will redirect all the traffic from http://yoursite.com to http://www.yoursite.com.

Open the file .htaccess with your online editor

find the line

RewriteEngine On

directly underneath that line add the following two lines

rewriteCond %{HTTP_HOST} ^yoursite\.com$
rewriteRule ^.*$ http://www.yoursite.com%{REQUEST_URI} [R=permanent,L]

You must have the lines that order otherwise it will not work.  Also change the code to list your site rather then yoursite.com

Save the file.

Now if you go to your site without the www it should redirect you to the same url except with the www

On some Host's servers you may need the lines

rewritecond %{http_host} ^yoursite.com [nc]

rewriterule ^(.*)$ http://www.yoursite.com/$1 [r=301,nc]

Rather then the lines above.

Last Updated on Tuesday, 03 May 2011 09:07