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

make www.foo.com/samp1 and www.foo.com/samp2 point to same file

Status
Not open for further replies.

Wickersty

Programmer
Nov 13, 2002
51
US
Hi,

Could anyone advise me how to go about doing this?

I want to make it so that if a user uses any of the following URLs (as an example):


they will all wind up at country_app.cfm, which will analyze the URL and do something like:

if /brazil, do this
if /usa, do this
if /mexico, do this

etc, etc...

Any ideas?

Jeff
 
implicitly what the server will see/use is


where .ext is whatever extension you server recognizes as default (hopefully .cfm).

on the page just do a redirect to the country_app.cfm with the CGI value for the URL path.


Code:
<cflocation url="country_app.cfm?path=#CGI.path_info#">

on country_app.cfm you could have something like...
Code:
<cfset originalPath=url.path>

<cfif listfind(originalPath,'brazil','/')>
YOU CAME FROM BRAZIL ......
</cfif>
That's just an idea, you obviously can find some other ways to optimize the code according to your needs.


grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
the pages would have to exist then in the page have
<cflocation URL=" token="yes">
Then you might be able to output the #cgi.HTTP_Referer#
and pick the /"referer" page out of it?
Im not sure i had a lot of trouble with REFERER so perhaps not your greatest idea
the best way is to make the page exist, then <cfset session.country_enter = thecountryspagename>
then have the cflocation, then in the country_app you could just use the #session.country_enter#
For example
<cfif IsDefined ("session.country_enter")>
process page as it has a country selected
<cfelse>
run selector
</cfif>
Your best bet though would be some sort of SSI, as this would normally throw an error, you could have a default error document that perhpas stored the variables ? im sure someone else will be able to elaborate what i am trying to get across!

CF Reference
The links of my knowledge
 
Yes, but what if I don't want all those directories to really exist? Meaning, if the folders /brazil and /usa and /mexico don't exist...

i want the server (or application.cfm if thats possible) to say... someone tried to go to and brazil doesn't exist, go instead to and include the fact that /brazil was tried to access...

and, of course, in the user's location bar, would still be present so they wouldn't be the wiser to the whole thing.


PS - thanks for the quick reply.

Jeff
 
That being the case...
you need to setup virtual folders on your web server and look for information on redirects.

I don't think is possible in CF without actually having the folders in the site.

The client request goes first to the web server then it gets passed to the app server (coldfusion), from there application.cfm starts kicking in.
Since you don't want to create the atual folder then your best bet would be to 'catch' the request at its earliest stage and that is at the web server level.



grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top