Let’s say, on a ColdFusion site, that the user has navigated to http://www.example.com/sub1/
The server-side code typically used to tell you what URL the user is at, looks like: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#
however, ‘cgi.script_name’ automatically includes the default cfm file for that folder- eg, that code, when parsed and expanded, is going to show us ‘http://www.example.com/sub1/index.cfm‘
So, whether the user is visiting sub1/index.cfm or sub1/, the ‘cgi.script_name’ var is going to include that ‘index.cfm’.
The question is, how does one figure out which URL the user actually visited? This question is mostly for SEO-purposes- It’s often preferable to 301 redirect ‘/index.cfm’ to ‘/’ to make sure there’s only one URL for any piece of content- Since this is mostly for the benefit of spiders, javascript isn’t an appropriate solution in this case. Also, assume one does not have access to isapi_rewrite or mod_rewrite- The question is how to achieve this within ColdFusion, specifically.
I suppose this won’t be possible.
If the client requests ‘GET /’, it will be translated by the web server to ‘GET /{whatever-default-file-exists-fist}’ before ColdFusion even gets invoked. (This is necessary for the web server to know that ColdFusion has to be invoked in the first place!)
From ColdFusion’s (or any application server’s) perspective, the client requested ‘GET /index.cfm’, and that’s what you see in
#CGI#.As you’ve pointed out yourself, it would be possible to make a distinction by using a URL-rewriting tool. Since you specifically excluded that path, I can only say that you’re out of luck here.