Unskilled ColdFusion developers can kill your search rankings

Monday, February 27th, 2006

I’ve run across a significant blunder twice in the past couple months when it comes to using <cflocation> for redirects on public web sites. Unless you are explicitly trying to remember the user’s session, pass a value of false for the addtoken attribute.

For example:



What addtoken does

If you don’t pass addtoken=”false”, or omit the attribute altogether, you will get a string that looks similar to this appended to the end of the user’s landing page URL:

CFID=3374228&CFTOKEN=a53a543a3e9e0383-AC6535AC-CCCD-1EEC-8A546E55A5D0EB29

This CFID/CFTOKEN string will never be repeated again as it will always be a unique value related to the user’s session. (It uses a ColdFusion unique user ID.) This tells Google, Yahoo!, MSN, and company that this landing page is unique to all other landing pages. Because all of these unique page URLs lead to the exact same content, your PageRank will either get docked, or, worse yet, your content will be ignored altogether when it comes to indexing.

When not to set addtoken=”true” (or leave it out altogether)

To keep it short, you get a lower PageRank as a result of setting addtoken to true.

Need proof? On a recent project, the web site’s home page was redirected elsewhere by a <cflocation> tag with the default value of true passed for addtoken. When I changed the value to false, the home page’s PageRank increased by two points within a week!

When you want to set addtoken=”true”

Of course, there are times when we do want the values of CFID and CFTOKEN to be passed in the URL. Why would the ColdFusion team offer the feature otherwise?

We may have a scenario where we don’t want to risk the user’s not accepting cookies. We may want to remember their session at all costs, even if the cost is a lower search score. We may not even be concern with a high search score because we don’t need for pages deep within an application to be indexed.

But for the scenario I discussed earlier involving the home page redirect, this was not the case.

Know what you’re doing

In summary, know your tools well. Don’t haphazardly use a tag like <cflocation> without knowing exactly what all of its attributes do and how it may affect your overall cause. Sure, ColdFusion is easy, but this makes it powerful. You have to write less code to get the results you want, but this requires that you write your code more accurately.

Technorati Tags:
,

Leave a Reply