EJM Designs Limited Blog

Monday, February 2, 2009

Fixing Your URLs and Permanent Redirects

Last time we were discussing the difference between how Google views and indexes underscores as opposed to hyphens, finishing with the idea that if you would like the "what's in a name" bonus for your page relevance, you should use the page naming conventions of being concise, descriptive, and separating the words in the name of the page with hyphens. A good example would be:

search-engine-marketing.php

Of course, if your site is already established and you've got a couple pages ranked but they're all named like:

search_engine_marketing.php

then you might think you're stuck. You could rename all your pages and update all the links and navigation site-wide, but then you're basically working with a blank slate - the search engines don't know about these pages. Square 1. And what about the pages you do have indexed? You could leave the old pages, but then it's duplicate content....

Fear not. I am not promising this will not temporarily dink your site rankings, but it's the best way to go about it if you want - in the long run - Google to read your page names.

  1. Copy all your current underscore-named pages and save them as hyphenated page names.
  2. Update all of your links and navigation to interact with the hyphenated page names.
  3. Replace the content of your underscore pages with a 301 Permanent redirect to its hyphenated counterpart.
  4. Create a new XML sitemap.
  5. Upload everything.
  6. Submit your XML sitemap.


(1) is pretty straightforward. And it works just the same if you're revamping an initial caps naming convention or anything else. I'm using the example of underscores because that was the topic last post. (2) is a basic update to make sure when you upload your pages you're not pointing to the old pages and when the bots come, they do the same.

(3) 301 Permanent Redirect
This is just a little bit of code that works on two levels. It automatically redirects anyone going to the old page directly to the new page. If you have indexed pages, those may be extant for a while and you don't want your potential customers getting a 404-not found error because you're tweaking optimization. It also tells browser-bots that the change is permanent, please update your listings. And since you're using the permanent redirect, no reason to worry about duplicate content.

So how do you do this? Relatively simple. This page is great because it provides coding for 301 permanent redirects in multiple languages. For example, the PHP script looks like this:


<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.domain.com/new-hypenated-page.php" );
?>


As I mentioned, it does two things you can see clearly here: says it's a permanent change and directs/informs to the new page location.

You're going to replace all the content in your underscore pages with a couple lines of code. For example, search-engine-marketing.php will still contain all the lovely content you had previously, but search_engine_marketing.php will contain only the redirect code, pointing to the hyphenated page.

And that's about it!

Upload your changes, including a new sitemap.xml file, submit that to the search engines, and you're done. As noted, you may see a small dip in your rankings as everything sorts out, but you'll be better off in the long run.

Feel free to contact me or comment with any questions.

No comments:

Post a Comment