skip to Main Content
301 Redirect

How and when to use a 301 redirect

Just like when you move home and you get a change of address form from the post office, when you move your website to a new address or you remove some old pages you need to inform search engines and web browsers what’s happening. The most efficient way to do this is with a 301 redirect.

 

What a 301 redirect does

A 301 redirect tells browsers that a page has moved permanently, pointing them to a new target that you’ve specified. Visitors will automatically be taken to the new URL and search engines will see that you’ve moved your content and will pass on any ranking benefits accordingly.

 

For example, if you owned oldwebsite.com.au and then bought newwebsite.com.au, a 301 would take all visitors who typed in oldwebsite.com.au (or followed a link, clicked on a bookmark etc) straight to newwebsite.com.au.

 

Without a 301, one of two things is likely to happen. A visitor is going to come across either a 404 error page (or a blank page) which might cause them to leave your site and find an alternative, or you’re going to have to find another way to get them where you want them. A simple message saying you’ve moved with a link to your new site is a common workaround, but it’s akin to using duct tape instead of going for the long term fix. You won’t pass on any SEO value you’ve earned on the old site and you’re not delivering the best user experience.

 

Times you would use a redirect

301 redirects are useful in a number of cases, specifically when you get rid of a page or website.

 

  • If you move domains, a 301 redirect will automatically take people going to the old site to your new one

  • If you register both the .com.au and .com version of your URL, you can set it up so people who go to the .com site by mistake are taken straight to the Australian version

  • If you post stats on a regular schedule, you might want to redirect people from an old version to the latest figures

  • If you remove content (such as discontinued stock) for any reason, you can redirect visitors to a relevant page

  • If you change your URL structure, you would redirect the old URLs to the new ones

  • If there are several ways to reach your homepage (say http://testbed.civicwebmedia.com.au/, http://home.civicwebmedia.com.au/ and http://civicwebmedia.com.au/ ) then you should use both a canonical tag and two 301 redirects for best effects

When you’re redirecting a URL – say you’ve bought another company or you’ve purchased a better URL – it can be tempting, and it’s certainly easier, just to have the whole site redirect to your new homepage. The best practise in these cases, however, is to set up individual 301 redirects for each page – or at least each subfolder/category – to the equivalent area on your new website.

 

How to set up a 301 redirect

While there are some WordPress plugins that claim to create 301 redirects for you easily, in our experience these do not work consistently well. This means that you need to get into your hosting files, through either FTP or cPanel, and make the changes yourself.

 

As with any work of this nature, it can be easy to make a mistake. Always back up your website before attempting to change files on your server.

 

To create a new 301 rule through cPanel, go to the File Manager and select ‘Web Root’ and make sure you tick ‘Show Hidden Files’.

 

When your files load you should see one called .htaccess. This is the file you want to edit, but it’s a good idea to always download a copy of it before you make any changes should anything go wrong.

 

To redirect a single page you need to have the following in your .htaccess file.

Redirect 301 /oldpage.html http://www.website.com.au/newpage.html

Redirect 301 Tells web browsers that a page has moved.

/oldpage.html Shows which page has moved. You don’t need to have the full URL here.

http://www.website.com.au/newpage.html Shows where the new page is.

 

If you’re moving more than one page, simply put the same code on the next line (starting again with ‘Redirect 301’) and put in the relevant URLs.

 

To redirect a whole website

Redirect 301 / http://www.newwebsite.com.au/

 

To redirect a whole site from/to a sub folder

Redirect 301 / http://www.newwebsite.com.au/subfolder/

Redirect 301 /subfolder http://www.newwebsite.com.au/

For more advanced redirects (such as changing all .php addresses to .html) it’s possible to create a rewrite rule, which is well explained here.

 

Planning ahead and creating a 301 redirect every time you change a URL or delete a page is all round the most practical way to do things, but every now and then a link slips through the cracks. To double check, log into Google Webmaster Tools and in the Crawl menu on the left, under Crawl Errors, you can see all the pages it’s expecting to find but can’t.

 

Image: “Detour” by Morgan Dobbins is licensed under CC BY 2.0

 

Back To Top
×Close search
Search