Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting URL Data

Status
Not open for further replies.

coldfused

Technical User
Jan 27, 2001
2,442
US
Ok guys please bare with me as this might get a little wordy but hopefully someone can help me understand how to get this done.

We are going to be tracking unique traffic front printed advertising ads and passing variables to our web analytics software. What I want to do is create an index page that resides at:

domain.com

This index page will have some sort of Coldfusion code that needs to detect the following:

domain.com/#PublicationName#

Publication Name will obviously be created to tie directly into the publication where the ad will be sent.

Is there a way to make Coldfusion detect whatever is after ".com/"? Can we grab that data and convert it to a variable?

I am trying to be able to do all of this without having to create individual directories with index pages in them.

Hopefully this makes sense.

Thanks in advance,
Carl

----------------------------------------
Internet Marketing - de·ci·phered
Always Learning...
 
You'll need to use a CGI Environment Variable:

I know that cgi.query_string gives you everything after the "?" in a url, but I don't think that's what you need. Maybe cgi.script_name? Not sure...

Anyway, all you have to do is surround the vars with pound signs like a cf variable and it will output the info. Play around with them to see which one you need.

Example:
Code:
<cfoutput>
  #cgi.script_name#
</cfoutput>

Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Ok cool that definately detects the data after the "/" which is perfect. So getting that data into a variable will not be an issue. The problem now is that there really arent any pages created for the path. Example:

domain.com/AtlantaJournal

Doesn't really exsist so the "Page Not Found" error pops up. So I'm guessing theres alot more envolved in this then what we have so far.

Do I have to do some sort of custom 404 error handling or something if the page or directory really doesnt exsist?

Is that possible?

----------------------------------------
Internet Marketing - de·ci·phered
Always Learning...
 
Right now I am testing a custom error page that looks like this:

Code:
<cfset media='#cgi.path_info#'>

<html>
<head>
<title>Error Handling</title>
</head>

<body>
<cfoutput>#media#</cfoutput>
</body>
</html>

Which outputs:

/404_error.cfm

Which is the name of the error page not the incorrect path that was entered. If I use cgi.script_name it outputs the same.

How do I detect the path that was entered incorrectly?


----------------------------------------
Internet Marketing - de·ci·phered
Always Learning...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top