Within this post I’ll be explaining what a redirect is, the difference between a 301 and a 302 redirect and how to set up redirects yourself. Right, let’s go:
What is a redirect?
A redirect is a command which automatically sends visitors to an alternative web page rather than the one they typed into their browser.
Why do you need to use redirects?
From time to time you may need to either delete a page, or change it’s URL. If you just go ahead and do this without a redirect, any visitor to the page will get a 404 which can be bad for users and for SEO (see our really rather good guide to managing broken links and 404′s and for more information).
Why are they important?
Redirects help users by automatically taking them to an alternative page, or indeed the same page if you’ve simply changed the URL. Likewise, redirect also tells search engines that the page has moved.
Plain English Definitions of those Pesky Numerical Wotsits
What’s the difference between a 301 and a 302? What’s a 404? How’s a 404 differ from a 500? Be confused no longer:
301 – Permanent Redirect: This tells the search engines that the page has moved permanently. Over time authority from the old page will pass to the new version.
302 – Temporary Redirect: This tells the search engine that the page has moved temporarily. As such no authority from the old page will pass to the new version.
404 - Error Page/File Not Found: This tells the search engine that the web page cannot be found
500 – Internal Server Error: This means there is a problem with the code which is affecting the server. This may have been caused by incorrect coding or command set up.
To 301 or 302… Which Redirect Should I Use?
- 301 – A permanent redirect should be used if you’ve changed the URL permanently. For SEO purposes it rocks as it helps maintain your natural search listing and indexing by the search engines (NB you might see a drop in rankings initially, but they should recover).
- 302 – A temporary redirect should be used only in the event that it’s a temporarily URL change. For SEO purposes it sucks as it passes no authority – therefore you might find that your lose rankings.
How do you set up redirects?
1. Open Notepad to create a new document.
2. Insert one of the following commands into notepad with your website URL address.
redirect 302 /old-webpage.html http://www.website.co.uk/new-webpage.html
redirect 301 /old-webpage.html http://www.website.co.uk/new-webpage.html
3. Save the notepad file as an HTACCESS file. You can do this by saving the file with the name .htaccess.
4. Make sure to select ‘All files’ in ‘Save as type’.
5. Open your FTP for your website. (Note: You will need to open the file in SFTP to be able to upload your HTACCESS file. You may need to enter a password to be able to log into the server.)
6. Upload the HTACCESS file to the root of your server. This is usually in the www folder on the server.
7. Test the web page to see that it is redirecting. (If the web page redirects from the old address to the new address, then the redirect is working.)
I’m still seeing the same web page even though I have uploaded the htaccess file. Have I done something wrong?
The redirect to the web page is probably incorrect. Check that you have put in the correct web page address. Also check your slashes ‘/’ and the web page language extension – htm, html, php, asp, aspx etc.
I’m receiving a 500 internal server error. What did I do wrong?
There is probably incorrect formatting in the HTACCESS file. Check the file for spacing and typing errors.
Hopefully now you’re good to go, but of course if you do have any queries please let me know via the comments.
Image source: Lumaxart