So, you’ve just moved your website to a new domain name, or perhaps you just replaced an old page with a new one that has a different title: a 301 redirect is for you.
A 301 redirect does two things to help you:
- It redirects visitors to an old page URL to a different page entirely.
- Most of the link popularity value of the old page (which helps you rank well in search engines) is passed to the new page.
How it’s Done
(sidenote: this tutorial explains how to perform the redirect in Apache, which is the most common type of web server, used by such providers as HostGator and Godaddy. Apache is also the most common server used for WordPress, Joomla, and Drupal websites–so this is probably the tutorial for you…)
- Open up your htaccess file with an FTP program such as Notepad++.
- You should place the code(s) at the end of the file, so that it/they don’t get in the way of other codes in the file.
- Place this code:Redirect 301 /somefolder/originalpage.html http://mywebsite.com/somefolder/newpage.html
The redirect code is 3 simple parts:
- first, type “Redirect 301″ and add a space
- second, copy and paste the full URL of the old page and delete everything before and including the “.com” or “.net” etc,…
- and third, copy and paste the full URL of the new page, but this time include the “http://” and the domain name.
It’s that simple!
Optional: I like to add a pair of comments to contain my 301 redirect(s) for organizational purposes (the “#” at the beginning of a line in an htaccess file indicates a comment):
# BEGIN Manual 301 Redirects by (my name), (my company name), (the date)
(insert 301-redirect codes here)
# END Manual 301 Redirects
Try it Now
The inspiration for this article comes from the 301 redirects that we needed to perform for our website after our recent upgrade. For example, we wanted links to our old social media page (http://milwaukeeseocompany.com/services/social-media/) to pass their value to our new social media page (http://milwaukeeseocompany.com/services/social-media/). Try going to the link above, and see what happens! Below is the screenshot of the actual code that we had to place in the htaccess file.
Advanced: a Fast Way to Do Multiple URLs at One Time
(sidenote: this section assumes that you’ve had Google Webmasters Tools setup correctly for your website all along, ie: before the changes were made to the pages)
After making massive changes to a website such as occurs in a redesign, it can save time to only redirect pages that were actually being linked to. In many cases, you’ll want to redirect pages whether they have links or not because human visitors to an old page may have it bookmarked, and will receive a 404 “page not found” error if they try to return to your website that way. In our case this wasn’t a concern because of the drastic changes that we made to the website (and we like the way our 404 error page looks :)), but we did want to pass the links to this page to the new page.
- Open up Google Webmaster Tools
- Go to “your site on the web” –> “links to your site”
- On the right-hand side, you will see a snapshot of your most linked content. Very insightful, but click “more” beneath this.
- Click “download this table.”
- Open up your new CSV file in your favorite spreadsheet program. I will be using Google Docs for this tutorial (though most of this translates to Excel and Calc easily).
- Insert one column left of the “your pages” column and place this exact phrase in all of the cells (case sensitive, and include the space at the end): “Redirect 301 ” In order for the space to register, you may have to do a copy/paste rather than a drag & copy–in any case, double check that the space was not stripped in the process by testing one of the cells.
- Now, add three columns to the right of the “your pages” column.
- In the first column, add a single space to each of the cells. (double-check here, too)
- Skip the second column for a moment, and add the concatenate function to all of the cells in the third column, concatenating the “Redirect 301 “, “your pages”, “space” columns and the empty column together into a single string.
- Now, copy or write in the full URLs of the new pages that correspond to each of the old pages that both have links and need redirection.
- All that you have to do now is–in one, fell swoop–copy all of the finished cells from the concatenated column, and paste them into your htaccess file, save the file to your web server, and test the old links to see if they take you to the new pages!
Please leave any questions or suggestions for future articles in the comments below. Thank you for reading!