Keeping HTTP redirects to a minimum for SEO and performance
You configure a HTTP redirect to automatically redirect one URL to another URL on your website.
There are several use-cases for this, but the main ones are:
- redirecting users to the latest URL of a page after you have renamed it
- redirecting users to the primary version of your website domain name
Redirects to your primary domain name
Say you have several domains for your website - acme.com, acme.co.uk and acme.eu. You should pick one of these to be your primary domain name, and redirect all of the variants to the primary version.
For example, you decide acme.com is going to be your primary domain name, you would then set up two redirects:
- acme.co.uk redirecting to acme.com
- acme.eu redirecting to acme.com
This means anyone typing acme.co.uk into their web browser would automatically be redirected to your primary domain acme.com.
Secondly, it's good practice to allow a www version of your domain name as well - it's not strictly necessary but is a hangover from the early days of the web whereby all websites would have www before the domain name, and even today many users still type www before the domain name when searching for a site.
Therefore you should decide whether your website's primary domain name should include the www portion or not, and again set up redirects as needed - for example in this case you decide the primary domain should NOT include the www component:
- www.acme.com redirecting to acme.com
- www.acme.co.uk redirecting to acme.com
- www.acme.eu redirecting to acme.com
Redirecting from an old page URL to a new one
Many websites use what is called a "slug" in the URL of a page. The slug is a simplified version of the page title, with spaces replaced by hyphens and any punctuation characters removed.
For example, a page with title "Best Products For Dog Owners" might end up with a slug of:
Search engines will index this URL with the slug. The problem comes if you decide to rename the article - perhaps the title is tweaked to be "Best Products For Small Dog Owners". In this case, in order to let the search engines know that things have changed, you should be a conscientious website owner and set up a redirect:
Using reports from e.g. Google Webmaster Tools, you can easily find out where your site has old URLs listed, and create redirects to ensure all indexed content corresponds to a live page on your website.
So what's the problem with redirects
There's no problem with using redirects in general - in fact it's part of being a responsible web citizen. The problem arises when your redirects correspond to a URL which is itself redirected, and you start to chain multiple redirects in a sequence.
Every time a redirect is encountered, there is a back and forth of requests between your web browser and the website server. This takes time, so if you have several of these going on, there will be a noticeable delay before your web page is displayed to the user.
So, best practice is to ensure that any redirect encountered will only redirect once to the final destination URL.