• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to strip #CGI.HTTP_REFERER# after the ? params?

Explorer ,
Mar 28, 2008 Mar 28, 2008

Copy link to clipboard

Copied

I am trying to store the #CGI.HTTP_REFERER# address into my database, which works, BUT, I don't want any characters after and including the ? in my url

for example, if I have
http://www.scooby.com/index.cfm?popo=yes&ID=22

I only want to store http://www.scooby.com/index.cfm

How can I strip that stuff after the ? before storing it?
TOPICS
Advanced techniques

Views

464

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Mar 28, 2008 Mar 28, 2008
Figured it out..

<cfset prefix = " http://">
<cfset full_path = "#prefix#" & "#CGI.SERVER_NAME#" & "#CGI.SCRIPT_NAME#">

Votes

Translate

Translate
Explorer ,
Mar 28, 2008 Mar 28, 2008

Copy link to clipboard

Copied

Figured it out..

<cfset prefix = " http://">
<cfset full_path = "#prefix#" & "#CGI.SERVER_NAME#" & "#CGI.SCRIPT_NAME#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 28, 2008 Mar 28, 2008

Copy link to clipboard

Copied

Scooby Doobie Doo wrote:
Figured it out..
<cfset prefix = " http://">
<cfset full_path = "#prefix#" & "#CGI.SERVER_NAME#" & "#CGI.SCRIPT_NAME#">


Those are two different things. CGI.SERVER_NAME and CGI.SCRIPT_NAME refer to the current page. CGI.HTTP_REFERER is the previous referring page.

You can use list functions to extract the first part of the HTTP_REFERER string

listFirst(CGI.HTTP_REFERER, "?")

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 28, 2008 Mar 28, 2008

Copy link to clipboard

Copied

LATEST
<cfset myNewLink = ReplaceNoCase(cgi.http_referer,"?"&cgi.query_string,"")>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation