Nerd Alert! Techie stuff ahead
As most people know I have had a nightmare with my web developers over the past five years with all of the problem they created detailed in some of the previous posts – see the links below. Only recently I discovered another little gem!
Most websites can be configured in two ways for example ours – www.shoes.co.uk and simply shoes.co.uk – without the www. It is really important to know this because of course Google does not like duplication and few people realise that these two URL’s can actually be configured differently. Of course you can tell Google which one you’d prefer and then stick to it but sometimes people will link back to the root domain and pages can start popping up with incorrect backlinks. This can be sorted by using canonical URL’s sitewide but it is good practice to put a redirect rule on the root – shoes.co.uk so that it redirects to www.shoes.co.uk – avoiding any issues.
This all sounds well and good but our bright developer put a rule in the .htaccess file 301 diverting ALL ULS’s using the root domain to the www version of the home page! So for example shoes.co.uk/mens/rockport – instead of 301’ing to www.shoes.co.uk/mens/rockport – it went to www.shoes.co.uk which is ridiculous!
The fix?
In the .htaccess file there was a rule set as follows:
RewriteCond %{HTTP_HOST} ^shoes.co.uk$
RewriteRule ^(.*)$ http://www.shoes.co.uk [R=301,L]
By changing the end of the www domain I was able to make sure that the rule 301’s correctly as it should in the Rockport example above.
RewriteCond %{HTTP_HOST} ^shoes.co.uk$
RewriteRule ^(.*)$ http://www.shoes.co.uk/$1 [R=301,L]
A small detail I know but it was coded incorrectly and would have caused all root URL’s to divert to the home page instead of the proper www.version.
I hope this is of help to someone outthere!
Nigel