Chris Peters: Web Developer

Creating search engine friendly links to dynamic pages

Filed under: Programming, Search Marketing — Chris Peters, June 18, 2005

First off, I apologize to any of you who have subscribed to my feed and are now receiving duplicate copies of my last five blog entries. It’s due to a change I’ve made to my site that I am about to discuss.

Those who read my last blog entry know that I am annoyed by the fact that my site doesn’t get visited often, so I’ve been focusing on improving that. The biggest problem I’ve been facing has been that none of my blog content is being spidered by Google or Yahoo!. This has been due to the fact that all of my blog entries’ URLs contain query strings that cause most of such pages to be ignored by search engine spiders. Here is an example of one such URL:

http://www.chrispetersweb.com/blog/
view.cfm?id=12

When the search engine spider sees the same file being linked to repeatedly on sites with a lower PageRank rating, it assumes that the query string (?id=12 in this example) will not lead to useful content being generated. For instance, Google’s Webmaster Guidelines suggests not having query strings if you want to ensure better results in getting all of your content crawled.

Ben Forta describes a ColdFusion custom tag-based solution for creating search-engine-friendly URLs in an article in the ColdFusion Developer’s Journal. Consider the example above and notice the change in this revised URL that leads to the same page:

http://www.chrispetersweb.com/blog/
view.cfm/id/12

With these kinds of links appearing on your Web site, spiders do not see a query string at all and will index your content.

Please note that Forta’s solution or your server settings may need to be tweaked, depending on how your server is set up. Also keep in mind that this solution should easily be translated into other languages than ColdFusion. For example, my Web server’s setting of cgi.PATH_INFO did not behave the way Forta’s solution assumed it would. His solution expects that cgi.PATH_INFO contains the whole path included in cgi.SCRIPT_NAME, along with the search-engine-friendly variable declarations appended to the end. My server is set so that cgi.PATH_INFO contains the exact same value as cgi.SCRIPT_NAME if no extra characters are appended to the end, but it is set to only the extra characters if there are any. I also tweaked the code so that it could be included directly in Application.cfm so that no errors will occur if there are no search-engine-friendly parameters being passed in the URL.

To see what is being set for the CGI variables, run this line of code two times, one with arbitrary values passed in this search engine friendly manner and one without any extra values passed after the file name:

<cfdump var=”#cgi#”>

If you’re interested, download my revised version of Forta’s code in custom tag form. Documentation on using the custom tag is included at the top of the file.

2 Comments »

  1. Thanks to Adam (Adrocknaphobia) for helping me remember to put pound signs around “cgi” in the cfdump statement.

    Comment by Chris Peters — June 22, 2005 @ 1:33 pm

  2. Now that Google is spidering all of my content, it’s hard to tell if this method is necessary. It appeared that Google still knew it was a dynamic page before the floodgates were open. This method may not be nearly as effective as it has been in the past.

    Comment by Chris Peters — October 23, 2005 @ 7:47 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment