How to Redirect One Web Page to Another
by dickson3748 in Circuits > Computers
5330 Views, 10 Favorites, 0 Comments
How to Redirect One Web Page to Another
There are a number of different ways to carry out redirects, each with their own pros and cons. In this example though we will concentrate on redirecting one page to another using the .htaccess file. This is the most common technique and also one of the simplest and most useful for search engine optimisation, particularly if a 301 redirect is used (more of which later!).
Getting Started
First of all, you’ll need to have noted down your original URL and the path that you’d like it to point to.
In this example, I’m going to use a page I’ve recently updated on www.unthankschool.com. The site has just completed a redesign that has changed the URL structure of several pages, including the new ‘Creative Writing Courses’ section. To stop people visiting the old URL and finding a 404 page a redirect will be used.
Original URL
http://www.unthankschool.com/courses.html
New URL
http://www.unthankschool.com/online-creative-writing-courses.html
In this example, I’m going to use a page I’ve recently updated on www.unthankschool.com. The site has just completed a redesign that has changed the URL structure of several pages, including the new ‘Creative Writing Courses’ section. To stop people visiting the old URL and finding a 404 page a redirect will be used.
Original URL
http://www.unthankschool.com/courses.html
New URL
http://www.unthankschool.com/online-creative-writing-courses.html
Finding Your .htaccess File
Next, it’s time to track down your .htaccess file. Open up your ftp client and search for it. I’m using Cyberduck for the Mac, but the process is similar for most tools such as Filezilla or CoreFTP.
Show Hidden Files
Quite often the file is hidden, so go to ‘Show hidden files’.
Open the File
Then locate the htaccess file. Now open in your text editor. Here, I’m using Fraise, but any other one will work just fine.
If you can’t find the file, you may need to create one. To do this simply make a blank file name ‘htaccess’ and add it to the top level of your site using your FTP program. Once it is uploaded change the filename to ‘.htaccess’ (the full stop is important!) and open as usual.
If you can’t find the file, you may need to create one. To do this simply make a blank file name ‘htaccess’ and add it to the top level of your site using your FTP program. Once it is uploaded change the filename to ‘.htaccess’ (the full stop is important!) and open as usual.
As you can see, my .htaccess file is blank. Yours may have a few lines of code already present, such as in the example below. Feel free to ignore this for now.
Choosing the Right Redirect
The next step is to add the redirect code. There are several different types that we can use, each of which has a specific purpose. These are:
301 redirect
This is a permanent redirect that tells Google that the original URL is no longer valid and has been moved to a new location. This is the best for SEO as the value of the old URL will be passed on to the new one.
302 redirect
This is a temporary redirect, meaning that it has been put in place for a limited amount of time. This is not as effective for SEO and should not be used unless you are certain that it is appropriate.
303, 304, 305 and 307 redirects
These codes are seldom used for most projects and we do not recommend using them. If you see them in your file though, it may be worth asking your developer or webmaster (if you have one) why they are there, and if they can be swapped for a 301.
301 redirect
This is a permanent redirect that tells Google that the original URL is no longer valid and has been moved to a new location. This is the best for SEO as the value of the old URL will be passed on to the new one.
302 redirect
This is a temporary redirect, meaning that it has been put in place for a limited amount of time. This is not as effective for SEO and should not be used unless you are certain that it is appropriate.
303, 304, 305 and 307 redirects
These codes are seldom used for most projects and we do not recommend using them. If you see them in your file though, it may be worth asking your developer or webmaster (if you have one) why they are there, and if they can be swapped for a 301.
Writing the Redirect
OK, the actual code for a redirect is very simple. First specify your code, then add the path of the URL minus the root domain. In my example this will be:
Redirect 301 /courses.html
Now add the full path of the page you’d like to redirect to. In this case it is http://www.unthankschool.com/online-creative-writing-courses.html.
The full code is Redirect 301 /courses.html http://www.unthankschool.com/online-creative-writing-courses.html
Redirect 301 /courses.html
Now add the full path of the page you’d like to redirect to. In this case it is http://www.unthankschool.com/online-creative-writing-courses.html.
The full code is Redirect 301 /courses.html http://www.unthankschool.com/online-creative-writing-courses.html
And that’s it! Now save the file and upload using your FTP client.
To check the redirect is working you can use this tool here -http://www.internetofficer.com/seo-tool/redirect-check/.
Congratulations – you now have a working, SEO-friendly 301 redirect in place! Not too difficult, was it?
To check the redirect is working you can use this tool here -http://www.internetofficer.com/seo-tool/redirect-check/.
Congratulations – you now have a working, SEO-friendly 301 redirect in place! Not too difficult, was it?