An experiment in search engine optimization:
My work site, http://www.economicsnetwork.ac.uk (or economicsnetwork.ac.uk if you’re intimate) is also known by three other domain names, because of past re-branding. My problem? How to tell search engines that these are the exact same site, so they know that an external link to, say, http://www.economics.ltsn.ac.uk is to count as a link to http://www.economicsnetwork.ac.uk (and boost my site’s Google ranking, goddamit!). Establishing a canonical domain name like this should also help consistency of brand (i.e. helping the user know what site they are on and what to call it).
For a long time I had a <base href=”…”> tag in my home page to set the canonical domain. This is dumb. It only ensures that a user sees the domain once they’ve come to the home page and then clicked a link. A check shows that www.economics.ltsn.ac.uk, www.economics.heacademy.ac.uk and econltsn.ilrt.bris.ac.uk still exist in the Google index as separate sites. A serious fix requires a few lines of Apache config:
RewriteEngine on RewriteCond %{HTTP_HOST} (ltsn|heacademy) RewriteRule (.*) http://www.economicsnetwork.ac.uk$1 [R=301,L]
In English, “If the request is pointed at a domain containing the strings ‘ltsn’ or ‘heacademy’, capture the complete path (the rest of the URL after the domain) and send the user a permanent redirect to the canonical domain plus that path.”
Something that took a while to get, and which caused a headache when I was setting the config for another site, was that if you have these directives in a .htaccess file rather than your main config file, the path is not assumed to have the initial slash, so you’d have to have a slightly different version.
RewriteEngine on RewriteCond %{HTTP_HOST} (ltsn|heacademy) RewriteRule (.*) http://www.economicsnetwork.ac.uk/$1 [R=301,L]
Google Webmaster Tools allow you to set whether or not you want the www. prefix to appear in the canonical domain of your site as it appears in search results. Will this apache tweak have any significant effect on search engine placement? I’ll report the results.
Leave a Reply