talideon.com

Blackout Ireland

March 15, 2005 at 10:30PM Using to get nicer URLs

Here’s another one of those things that sits at the back of your head, gnawing at your attention until you think to yourself, “bugger it, I have to take a look”. And I did.

I think it might be possible to use the CFERROR tag to give this site nicer URLs. Despite my protests that a decently-written URL rewriter wouldn’t have all that much impact on the overall speed of the server, the lads have refused to let me write one and install it. So be it.

But I can get around that. With CFERROR, I can catch any bad requests and frob about with the URL to find out what exactly to display. Oh frabjous day!

Fun stuff coming as soon as I can be bothered to implement it.

Update: ok, maybe not. Apparently, in CF5 at least (which I’m stuck with on this server for now), a page set up as a request error handler can’t include CFML tags, and is wrapped in an implicit CFOUTPUT tag. Grr! So much for my fiendish plans.

Comments

1 On May 3, 2006 at 19:37, Jay Proulx wrote:

Try using a ColdFusion custom 404 page for redirects. While my site is in PHP, that’s actually how all of the requests on the site are handled.

It’s really convenient actually, any file that actually exists on the site gets pulled up (like images, etc.) But if you write some code to handle requests in certain formats, then all you need to do is make a request to your site in your format, then figure out what you want to do with it.

This page doesn’t actually exist on my site: http://www.pollensoft.com/services/justoneseed

But I know what section and page you wanted..

This file really does exist: http://www.pollensoft.com/images/logo.gif

So apache just serves it up.

I’m actually trying to do the same thing on a customer site, this post came up in a google search. I thought ColdFusion might have a direct way of handling it, guess i gotta go with the old 404 trick :P