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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL, After the Slash

Status
Not open for further replies.

pixiesfb

Programmer
Apr 27, 2001
62
0
0
US
Hi,

Say I give someone a URL like
I'd like to capture the word &quot;cats&quot;, which I know I can do with something like <cfset urlcode=GetToken(cgi.path_info,3,&quot;/&quot;)> (although I havn't tested it yet).

The problem is that I don't want to set up any new directories because I plan on having many of these &quot;trailers&quot; that I want to grab.

Any ideas are appreciated!
 
I am not sure what you are wanting to do, but are you looking at being able to provide a url such as and have that url go to a specific page, but not have to create a directory on the server?

If so, there is a tag in the developers exchanage called cf_plainurl that will convert a &quot;path&quot; like url to a query string url

There is also one on the fusebox site that does the same thing.

HTH,
Tim P.
 
Mmmm,

I'm attempting to just capture &quot;cats&quot;, then perhaps redirect to the domain.

I tried doing this in application.cfm, but it wasn't happy.

I checked out that custom tag, but can't get it to work. Perhaps a simple modification is all I need but I couldn't get it.


Here is the custom tag:

<!--- this script translates the following URL format into URL variables --->
<!--- --->

<cfloop list=&quot;#removeChars(cgi.path_info,1,len(cgi.script_name))#&quot; delimiters=&quot;/&quot; index=&quot;variableSet&quot;>
<cfscript>
variableName = &quot;url.&quot; & listGetAt(variableSet,1,'.');
expression = listGetAt(variableSet,2,'.');
</cfscript>
<cfparam name=&quot;#variableName#&quot; default=&quot;#expression#&quot;>
</cfloop>
 
Yes, capturing is the easy part.

Check out
and for the CF_FakeURL custom tag.

The hard part is that you get a 404 error because &quot;cats&quot; is recognized as a directory, (which does not exist).

To fix the prob, go into IIS, choose your virtual dir/ properties/ custom errors tab/ URL, (specify URL).

You should also go to the Virtual Directory tab/ Configuration button/ App Mappings/ .cfm/ check the &quot;Check if file exists&quot; checkbox.

This solves the problem. However, it is not an attractive solution to me because these settings would be made on a co-lo server and we won't have complete control.

Sooo, right now I am stuck with a much less sexy solution of providing a URL like instead of something slick like
 
No, same problem, thinks it's a directory.
 
Really? I've been able to effectively use this method on IIS and apache. What error do you get? - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top