Blog of an Open Mind

Open Minded Thinking from the Open Minded Solutions team…

Blog of an Open Mind header image 2

ColdFusion and IsapiRewrite Gubbins…

April 14th, 2009 · No Comments

Had a minor issue today from a client using Open Mind Commerce that took a bit of time to track down and solve but the solution was quite simple so I thought I would share…

Open Mind Commerce uses ISAPI Rewrite to produce search engine sexy (I don’t like the word safe) URLs so is rewritten server side so the template actually executes

Now this works great until the client changes the URL structure in their settings which although a great feature for setting the actual URL can lead to duplicate content in the SEs.

I had to find a way to look at the URL before it was rewritten, compare this to the real URL in the database and then redirect if it was different.


This variable supplies you with the raw URL before it is rewritten server side, bonza! So pseudo code time…

<cfif cgi.HTTP_X_REWRITE_URL NEQ "my stored URL">
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="">

All we are doing here is comparing the incoming rewritten url with the one that should be in use (from our database) and then using the cfheader command to do a 301 redirect. The result? No more dupes…

Tags: Tinterweb stuff

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

You must log in to post a comment.