Link to home
Start Free TrialLog in
Avatar of Ian White
Ian WhiteFlag for Australia

asked on

Overcome values in url parms throwing an error

Some of my dynamic Cold fusion pages with url parms have been indexed in search engines.

However the search engines have added some hex values into the query string and it
throws an error when people link back to my page as my cold fusion code is expecting url parms that cant now be found due to the extra hex characters in cgi.string
 Here is the error:

HTTP Referrer     http://us.m2.yahoo.com/w/onesearch?.lang=en&p=housesitting+in+Tampa&.tsrc=apple&submit=oneSearch&tsrc=apple&first=1
         Template          /city_house_sitter_profile.cfm
     Query String      MEM=2145548445&%253Bci=Tampa&%253Bst=Florida
     User name        
     HTML Code Format  <PRE>Element CI is undefined in URL.  &lt;br&gt;The error occurred on line 3.</PRE>

So  the search engine has added %253B - and cold fusion now cant find url.ci

How do I get around this so I can get the value of url.ci  or remove %253B
I understand cgi-query-sting is read only so cant change it?

Thanks
Avatar of azadisaryev
azadisaryev
Flag of Hong Kong image

the more important question is why would %253B be added by search engines?

it should not, unless your query string originally was malformed and contained characters that had to be url-encoded but were not.

but to get around your current problem:
at the very top of your pages loop over URL collection and set new url vars without %3B in the name (see note below why it is %3B). see attached code.

NOTE: %253B decodes to %3B, which is url-encoded ; (semicolon), so the attached code replaced %3B in the url var names

Azadi
<cfloop collection="#url#" item="key">
<cfset url[replace(key, '%3B', '')] = url[key]>
</cfloop>
<cfdump var="#url#">

Open in new window

Avatar of Ian White

ASKER

Hi

Thanks for your quick response.

I still had it crashing when I click direct from Yahoo even though I put the code in the
top of header of page.

If I make  up the page url from the error message and input into my browser it works ok ie:
http://www.housecarers.com/city_house_sitter_profile.cfm?MEM=2145522029&%253Bci=Tampa&%253Bst=Florida

So I am wondering why it is not working when clicking from the yahooo search engine listing at:

http://us.m2.yahoo.com/w/onesearch?_lang=en&p=housesitting+in+Tampa&_tsrc=apple&submit=oneSearch&tsrc=apple&first=1&_ym=1
ASKER CERTIFIED SOLUTION
Avatar of azadisaryev
azadisaryev
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i am sorry, but i do not believe that AveAGo's own comment was any 'solution' at all.
my comments, on the other hand, provided a fully working solution to the problem.
i believe i deserve all the points in this case.
sorry I was confused by the system - I am new - I thought I gave you the points?
Thanks for the solution
thanks, yes it is a bit confusing at times...
glad i could help you!

Azadi