Canonical Urls And 301 Htaccess Redirects In Joomla

Canonical Urls And 301 Htaccess Redirects In Joomla

The basic problem is that Google views the www version and the non www version ( and as two pages it needs to index not one as you or I would think. The can lead to content on your site being index twice thus making it duplicate content. At worst you can be penalized for this at best your hard won page rank may be split between the pages rather than concentrated in one. This problem is compounded in joomla if the global setting use Apache mod_rewrite is not switched on. You get the index.php appearing everywhere. So in fact Google may index four pages rather than one as seen below:

There are two parts to the solution to this problem:
First secondly
We need to check the Apache server’s configuration. We need to have the mod_rewrite setting switched on. If this setting is switched off you will have to approach the Apache server’s administrator to see if they will turn it on. If we know our hosting does have this setting on then we simply switch on the following setting in the Joomla websites Global configuration in the section handily named SEO Settings. You can see the Search Engine Friendly URLs setting is also switched on.

The next step is not as easy and involves the use of the .htaccess file. This file can override features of the server it is on. Most of this can be done via Plesk Control panel or other control panels provided by tour hosting company. You can alos edit this file via and FTP client such as Filezilla. Download a copy locally to edit then upload gain after changes have been made.
This file originally appears as the htccess file. First take a back up of this file in case things go wrong. Then rename a copy to .htaccess (via Plesk).
Edit this file (via File manager in Plesk or via your favourite FTP client) and add these lines of code:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %HTTP_HOST !^$
RewriteRule (.*) http://www.$1 [R=301,L]
The first two lines are usually already included in the .htaccess file, if so do not add them again. Obviously you have to replace the domain name. Now upload this file to your website root directory.
To test the redirect type the non www URL into browsers address bar, this should redirect straight away to the www version of URL.

Leave a Reply

Your email address will not be published.

Follow by Email