Redirecting Traffic from One URL to Another using .htaccess

July 25, 2007 | Comments (9) | Filed under: Traffic

Recently, I’ve been in the process of migrating from my old blog (www.fuzzyfuture.com) to my new one Bookmark Bliss. There are a variety of reasons I’ve decided to make the switch, but the short version is that I wanted to move to a URL that more accurately conveyed the theme of my content and also is not tied up in any way to my business. When moving an existing site from one URL to another, there are actually quite a few things you might not think about that you need to take care of. One of the biggest is properly redirecting traffic heading to your old content to the appropriate location in your new site.

You want to do this for two reasons. The first is to make the change seamless to your existing readers. When visitors arrive at your old site via search engines, social networking sites, back links, or even just plain old bookmarks in their browser, the last thing you want to give them is a big glaring 404 error indicating page not found. That’s the fastest way to lose that reader forever by convincing them that your site no longer exists.

stockxpertcom-id2327311-size1.jpg

The second reason to redirect traffic is to maintain as much of your existing search engine result placements and back links as you possibly can. If your old site existed for any length of time, you’ve inevitably built up links to your content from other sites on the web. In addition, your content has probably started to bubble itself into Google results and, depending on how much work you’ve done, might even be ranking well for your targeted keywords. If you’re running a blog, you might also be interested in maintaining your “authority” points in Technorati as well…

The bottom line is, you want to minimize the losses in visitors and ranking as much as you possibly can…

If you’re running a WordPress blog, there are many plugins available that can help you accomplish this goal. For example, in my quick search I came across these two, Permalink Redirect and Permanent Redirector. However, I personally find the best way to accomplish this goal is to redirect traffic from your previous URL manually using mod_rewrite (a convenient mod_rewrite cheat sheet) and your .htaccess file. Choosing the right tools to accomplish this goal really depends on your level of technical expertise as well as your flexibility requirements. Nonetheless, no matter which method you choose, the form of redirection you ultimately want is a 301 redirect.

A 301 redirect is a method of telling web browsers and search engines that a web page or site has been permanently moved to a new location. Usually a 301 redirect includes the address to which the resource has been moved. Web browsers will typically follow 301 redirects to the new location automatically, without the need for user action. A 301 redirect should be used whenever a website is moved to a new domain name (URL) so that search engines will quickly change their indeces and, in theory, preserve the search engine rankings that the site had at the previous domain.

If you’ve gone ahead and moved your site entirely from one location to another, but maintained an identical structure for your articles, you can simply add the following to your .htaccess file and completely transfer all your traffic via a 301 redirect:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.old-domain.com$ [NC]
RewriteRule ^(.*)$ http://www.new-domain.com/$1 [R=301,L]

While this may look a bit complicated, what it is basically saying is that any visits to your site via your old domain name should have the old domain replaced by the new domain, but keep everything else in tact. So, http://www.fuzzyfuture.com/contact-us would redirect to http://www.bookmarkbliss.com/contact-us. The R=301 tells Google and other visitors that this modification is permanent, and that they should update all their links and rankings to reflect the change. While there is no guarantee that Google (or anyone else for that matter) will give you full credit for your links and page ranks, you can expect that as they update their index, your old pages should be replaced by your new ones in the SERPs.

Even Technorati makes an effort to regenerate your authority over time and slowly propagates in your new redirected links:

If the domain of your blog is different (example: myblog.blogspot.com is now myblog.com), please note that we are unable transfer or combine links from different URLs at this time. Links are URL-based and are unique citations to that blog at that time. However, if you permanently redirect the old blog URL to the new blog URL by sending a permanent redirect response (HTTP Status 301) to anyone requesting the old URL, it will help consolidate your online blog presence for all web aggregators and help have your links reestablished eventually. Apache’s mod_rewrite is a popular method of handling such requests.

For the specific case of redirecting Fuzzy Future to Bookmark Bliss, I needed a little more flexibility then I was able to get from standard WordPress plugins. My goal is to continue to use the Fuzzy Future URL, but still have all my old blog pages redirected here. I needed a solution that redirected most of the incoming traffic, but not all of it. To accomplish this, I ended up customizing my own .htaccess file to get the desired result. Here is the .htaccess file currently in place at Fuzzy Future.

If you take a peek you can see that while it’s slightly more complicated then above it’s really not that bad when you look at it. All I’m really doing is changing where some pages end up in my new site, as well as making sure all my categories and archives arrive at their correct locations. With this file in place, I can now continue to use the www.fuzzyfuture.com URL for a different website, while still not losing any of the traffic and rankings coming to my older articles.

Using a 301 redirect on your articles is not generally a speedy process of change. Google and other engines will very slowly update their records and can sometimes take upwards of a year or more before finally filtering out your old URLs. So, when implementing a 301 redirect on your site, be absolutely sure that this is a permanent redirect that your are planning to keep active for a very long time. One month won’t cut it, so make sure you’re there for the long haul.

if you need help with mod_rewrite, there are several great resources you can check out in addition to the cheat sheet I linked earlier. The mod_rewrite forums, digital point, and the webmaster world forums are just a few of the many resources. Of course, you can always get in touch with me as well and I’ll do my best to give you any help that I can. Even better, leave a comment and some one will surely be able to point you in the right direction.

9 people have left comments

I have used htaccess as well and is pretty cool. If your site is on .NET (not PHP) you have a very useful tool (urlrewriter) very helpful… anyway, good post!

Frucomerci wrote on July 25, 2007 - 8:09 am | Visit Link

I’ve actually used a tool for IIS rewriting called ISAPI_Rewrite. It was pretty similar to mod_rewrite syntax wise. I’m sure urlrewriter is very similar. Thanks for the tip Frucomerci!

Stark wrote on July 25, 2007 - 8:52 am | Visit Link

Your welcome stark! I know the ISAPI filter for the IIS you talk about, I have used it too! All are very useful for SEO!

Frucomerci wrote on July 26, 2007 - 1:18 am | Visit Link

The Technorati answer appears a bit fuzzy to me. I’ve recently moved my blog, and while the domain is the same, the permalink structure is different, so I’ve used 301 redirect.

A week after the move I’m already seeing my Technorati authority in free-fall :-(

Zoli Erdos wrote on July 29, 2007 - 4:43 pm | Visit Link

Yeah, my sites been redirected about 2 weeks or so now, and so far Technorati hasn’t changed a thing. If they do update authority like they say they do, I would wager it probably takes a long while. They probably wait until Google updates all of it’s information, then if the old post gets re-pinged by Technorati, you might get credit.

As a test, try going to a blog you know has a link to you, grab the url for the permalink (make sure your 301 is working for that link) and submit the link to Pingomatic just so that Technorati grabs the post again and updates its records.

I don’t know if it will make a difference, but I think I might give it a shot. My old authority was somewhere at the 350 mark, but now it’s 5 :(

Stark wrote on July 29, 2007 - 5:59 pm | Visit Link

Personally I like htaccess use with php to redirect my site or change the address to easy remember

Hardhono wrote on September 26, 2007 - 7:18 pm | Visit Link

This allows you to have multiple domains point to the new-site.com domain name.

ServerName www.old-site.com
ServerAlias old-site.com another-old-site.com
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^new-site\.com
RewriteRule ^(.*)$ http://www.new-site.com$1 [R=301,L]

Eric wrote on January 6, 2008 - 6:52 am | Visit Link
Bookmarkables for 30 July 2007 : FocusMinded.com wrote on July 30, 2007 - 1:01 am | Visit Link
Zoli’s Blog » Blog Archive » Technorati Authority in Free-fall wrote on July 30, 2007 - 8:38 am | Visit Link

feel free to leave a comment

Comment Guidelines: Basic XHTML is allowed (a href, strong, em, code). All line breaks and paragraphs are automatically generated. Off-topic or inappropriate comments will be edited or deleted. Email addresses will never be published. Keep it PG-13 people!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

All fields marked with " * " are required.