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!

Fake URLs

Status
Not open for further replies.

DomTrix

Programmer
Dec 28, 2004
94
GB
I have a site using CF that I want to use "fake" URLs to access dynamic content. The site is an online bookstore.

An example:

I would like the URL:
To be something like:
Now I understand that I need (or I think I need) to use a cgi script to do this. In this case the cgi script would be called shop.cgi and placed in the root directory, it would then parse "/#categoryName#6.htm" to get the correct dynamic content.

2 questions:

1.) Is there a way to do this in CF without CGI scripting?
2.) If not, can I output coldfusion tags in the html outputted by my cgi script and have it working?


Basically what I want is a cgi script to convert the fake URL into a real one that it includes using

<cfinclude template="#realURL#">


Hope I've made any sense and thanks in advance

DT
 
you could do it with a coldfusion 404 handler, but there may be other (better) ways too

a 404 handler receives the url if the web server cannot find a resource at that url

then the 404 handler deciphers the url, decides whether it actually is Not Found (in which case it issues a real 404), or else does whatever you want, such as CFINCLUDE the real template

that's what i do on my site, except i don't include other templates, i pull the page out of a database


r937.com | rudy.ca
 
Thankyou r,

How do your stats appear in this case? i.e. is it just loads of 404 error pages appearing on pages hit or does it list the "virtual URLs"?

This was my first idea when I saw someone doing this (the 404) so tried it. Could get a custom 404 error page to appear using IIS (for invalid html files) but I could not get coldfusion tags to work.

I also could not set up a custom 404 page for coldfusion pages not found (using CFIDE - MX Developer ed.). Searched and searched for documentation on it but found nothing.

Thanks again
dt
 
my stats are produced by SmarterStats, and i see them under the "fake" url

i don't actually bother issuing a real 404 if i don't have whatever was requested (reasons why on request)

can't help you with the IIS, sorry, i'm not a server guy, all i had to do was name the 404handler template in my web host's control center

r937.com | rudy.ca
 
Ok cool, thanks, Ill have a good look around my host panel, mbe ask em about it on Monday when I get back to work proper.

tx again
 
if this is for SEO, Mine are formated like so

used to be file.cfm?id=33
now is like file.cfm/id/33/

Search engines view file.cfm, id and 33 as folders, not url parameters. Stats show them this way just fine.



 
Cool thanks, yes it is. Was just curious as to what was doable (and for what hassle/cost). I like the idea of having really clean, user-readable urls too, but it's not easily possible with our current server and host setup.

Will look into substituting '?' and '&' for '/' though thank you.
 
Look into it, you can fine the code on easycfm i think.
It pops right in and I have not had any issues with it. In fact, I have pages in yahoo and google that never got listed in the past two years before I did this. = great for adsense :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top