www or non-www URL's

If your Joomla site is accessible either with AND without a www-prefix you coud have an issue with duplicate URL's. Google could see both versions of your pages as multiple instances of the same content and penalize your site for it. Make sure you choose one of those and make sure the other one is not accessible at all. Which one you choose does not matter for Google, but if Google does not care, why bother to type the www every time. Unless there are specific reasons, choose the non-www version.

After you made your choice, configure your site to be accessible through only the chosen version, and set up a redirect from the non-preferred version to the preferred one. If you already have a SEF extension on your site, it may already have an option to do so. If not, it is very easy to set up the redirect in your .htaccess file:

www to non-www redirect

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

non-www to www redirect

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

After the change, always check if the redirect works as desired, or even that the site still works. A minimal typo could already result in a blank page or server error (500 code)... If this happens, just undo your change, or restore the .htaccess version distributed with new Joomla installs. By the way, if you use Akeeba's AdminTools, you can configure the redirect within the .htaccess maker.

logo 500

Specify preferred domain in Google Webmastertools

Secondly, make sure to go into Google Webmaster Tools and specify how you want Google to index your site, with or without www. Even if you already performed the previous step, still do so. It's a very simple step in the configuration: Click the configuration icon in your Webmaster configuration and click Site Settings. Then you can set the preferred domain.

site-settings-google-webmaster-tools

SSL versions of your site

Note that when you install an SSL certificate, you could have the same issue as well: http:// and https:// also create duplicate versions of your pages. Also here, enforce the preferred version (obviously, use the https:// version) and also repeat the process in Webmaster Tools / Search Console. This process is described in great detail in my blogpost about SSL for Joomla.

Advanced tweaking

A while ago I had issues with one of my sites, where for some pages the IP-address version of the site was indexed by Google. Usually, this is no problem at all (so only apply this fix if you spot issues!), but in this case I needed to solve it. I redirected all traffic directed over the IP-address of my server to the actual site, using a variation of the code above, where XXX.XXX.XXX.XXX needs to be replaced by the IP-address:

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

Sometimes you can even have other variations of your domain. Just make sure to monitor your SEO status to keep track of this.

About this site

Joomlaseo.com is fully built and written by Simon Kloostra, SEO Specialist and Webdesigner from the Netherlands. I have also published a book and blogs for companies like OStraining, TemplateMonster, SEMrush and others.