Over the last week or so there seem to have been quite a lot of conversations on social media channels about duplicate content and canonicalisation issues on Content Management systems (CMS) such as Joomla, WordPress and Drupal. Joomla appears to have been given a bit of a hard time with many comments giving the impression that Joomla would be a poor choice for anyone interested in SEO. In a bid to clear Joomla’s name and hopefully dispel the myth that it isn’t a good choice of CMS I thought that I would give some guidance for anyone that might need help resolving canonicalisation issues with Joomla.

You will need to have access to the .htaccess file located on your server.

Make a backup of the code the is currently contained in your .htaccess file just in case you need to revert back to it.

If you have added any custom code to the Joomla .htaccess file then make a copy of this code and add it to the end of the code below.

Delete all of the code within your .htaccess file and replace it with the code below.

Change domain.co.uk to your domain.

Activate SEF URLs within Joomla’s Global Configuration.

That’s it!

# ———————————————————————————————

 

Options +FollowSymLinks

RewriteEngine On

# prevents people from accessing anything with phpMyAdmin
RewriteRule phpMyAdmin – [F]

# Remove index.php or index.htm/html from URL requests
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index\.(php|html?)\ HTTP/
RewriteCond %{REQUEST_URI} !^/administrator
RewriteRule ^([^/]+/)*index\.(html?|php)$ http://www.domain.co.uk/$1 [R=301,L]

# force canonical www if request is for non-www or has port number etc
RewriteCond %{HTTP_HOST} !^(www\.domain\.co\.uk)?$
RewriteRule (.*) http://www.domain.co.uk/$1 [R=301,L]

redirect 301 /home.html http://www.domain.co.uk/

RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]

RewriteBase /
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

  • SBA 2016 Winner
  • chamber