Duplicate Content and Joomla: Fixing htaccess

Joomla is a powerful platform capable of growing along with your business  However, duplicate content issues are a major problem with many Joomla sites if they haven’t been optimized correctly upfront. Fixing your .htaccess file to eliminate some of these issues will help.

An htaccess file is a file automatically installed during Joomla installation to manage your web server configuration. With Joomla installations, there is no automatic redirect involving www and non-www URLs.

This results in duplicated files and confused search engines  Google and Bing ask you to choose one in Webmaster Tools, and it’s also important to choose one in Joomla. There are several ways to do this, but here we’ll show you how with your htaccess file.

You can also run into duplicate content issues with /index.php issues and /home tag on your home page. Why is this an issue? If 2 pages are identical and both have links to them and are used, the can split page rank, lowering the page’s effectiveness.

In the Joomla Global Configuration Site tab, go to the SEO section and change Search Engine Friendly URLs to “Yes”.

Located in your main directory as htaccess.txt, the following code changes will fix these issues for you. If you are using an Apache server, rename this file to .htaccess  Keep in mind: ALWAYS make a back-up of your files before altering the code to prevent files from getting lost  It’s also a good idea to have a backup copy of the Joomla and Template you are using on hand.

Redirecting to www. or non-www. version (pick one, and be consistent with Google and Bing Webmaster Tools)

To redirect to www:
underneath the line “RewriteEngine On”

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

or, to redirect to non-www: (be sure to change “yourdomainname”)
underneath the line “RewriteEngine On”

RewriteCond %{HTTP_HOST} ^www.yoursite.com$ [NC]
RewriteRule ^(.*)$ http://yourdomainname.com/$1 [R=301,L]

Removing index.php: (under the code above)

www. version:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html) [NC]
RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]

or, non-www. version:  (change “yourdomainname”)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html) [NC]
RewriteRule ^index\.php$ http://yourdomainname.com [R=301,L]

Removing the /home attached to your home page: (under the code above)

www. version:
Redirect 301 /home http://www.yourdomainname.com/

or, non-www. version:
Redirect 301 /home http://yourdomainname.com/

Now, test your website by typing in the www. and a non-www. version. Then try typing your home page with a /index.php at the end and make sure it redirects to the home page without the /index.php showing. Then try the same with /home. Even physicians understand how to integrate technologies in the right way, so you, as a typical nerd, should have no problemsb here.

Going back to Global Configurations in the Joomla Administrator, change “Use URL rewriting” to Yes, and “Adds Suffix to Url” to No. And if you can’t manage this yourself, make sure to find someone that knows how to manage these products properly!

That’s it, your .htaccess is performing a few extra operations that will improve your Joomla SEO!