Is there a way to create a sort of "Pseudo Directory" using ColdFusion or IIS?

Polishka-Renicon used Ask the Experts™
Does anyone know of a way to create a kind of "Pseudo Directory"  (fake directory) so the browser believes it exists  and not toss an error?

I'm new to programming and the reason I want this is to create a more friendly URL using forward slashes instead of  hyphens to separate content and ideas for the area we wish to send the user.

We're using ColdFusion 11 Enterprise on Windows Server 2012 R2, IIS 8.5, and SQL2008.

URL ReWrite does not work correctly for me to do this (that is a currently open question of mine on the subject).

I could use Active ColdFusion Mappings but that would require a bit  too many to manage and there could be duplicates that may lead to errors. This needs to be simple. I can hardcode them into the URL by creating the directories on the fly but hoped this could be simpler with some function I don't know about.

I can use CFDirectory to create the directory okay, and use IIS to control the default document but that means creating lots of empty directories. That's not a big problem but if it's not necessary why bother?

I understand it is the client side that sees and executes the result of the browser but was wondering if there's some ColdFusion function, tag, etc, I've missed that might possibly do what I want?


I can create variables for the above and insert them but did not want to bother with forcing me to create the directories.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2014
I've read your other post and I'm not really an expert in this area, but just a few comments:

URL stands for Universal Resource Locator, basically where to find something.  URL rewriting is a way to change where something is looking to someplace else.

What you want to do is take "/event/?id=23" and somehow magically change it to "event/YYYY-MM-DD/CategoryName/"

I don't think URL rewrite can do this, because in order to map "id=23" to "YYYY-MM-DD/CategoryName/", you would need a id number for every possible YYYY-MM-DD/CategoryName possibility.  Just for one year, one CategoryName you would need 365 ID's, if you had say 100 CategoryNames, you would need 3650 ID's.

Now the other issue is what actually happens when a URL rewrite is done.   First, the URL rewrite is done BEFORE the webserver looks for what resource it is supposed to display, so URL rewriting changes where the server is looking.  So if you change "/event" to "/event/YYYY-MM-DD/CategoryName", then the server want to look for the file "CategoryName" in the folder "/event/YYYY-MM-DD".  Which means the folder has to exist if all you are doing is a URL rewrite.

What is the solution?  Well easy, sort of, (and I think this was stated in your other post), you need a program/script that gets invoked when you change the URL to "/event/YYYY-MM-DD/CategoryName" that dynamically generates the content you want to display.

I'n not sure if IIS can do this, but I know in Apache you can configure a file handler.  That is you tell Apache whenever you see a file name or name pattern , to execute a specific script.  Then within that script you do whatever you want.   I'm not sure if IIS can do that though.   I'm not sure how many CategoryNames you will have, but if you could suffix them with say ".mcat" then if IIS support file handlers, then you would tell IIS whenever you see "*.mcat" execute the script "MyConvertScript" and then in MyConvertScript create the content you want based on the URL "YYYY-MM-DD/CategoryName".


Thanks giltjr for taking your time to answer. I really do appreciate it.

Yes, I'm familiar with the acronym URL, very basic stuff. But then you don't know how much I know, but I can't help pointing out that the difference between understanding the meaning of URL and how to get URL ReWrite to change ?id= into something else, as advertised, are worlds apart.

If, as you suggest, there is no way to change the URL from '?id=' (if that is what you are saying) into a word or into a variable, then why is it called URL ReWrite and why does the program very clearly state that this simple string can be changed? It makes no sense to me and no one has been able to state it in any way at all. I cannot continue to return here only to find nothing helpful. Yours has been the best so don't feel I'm picking on you. I do appreciate it.

I  don't want to change /event/?id=23" into "event/YYYY-MM-DD/CategoryName/". The date format was just an idea. I want to change it into a name of my choice or simply use one of the suggestions given by URL ReWrite. That is the point and frankly, I cannot understand why this is so difficult.

Also, I don't really expect URL ReWrite to use the actual ID, or the Uniqueidentifier. I can supply that from the cfquery easily enough.

 So, your concern about:
>you would need a id number for every possible YYYY-MM-DD/CategoryName possibility.
is understandable but I don't think important when I would use a variable.

> you need a program/script that gets invoked
Sounds great but so easy to state. I have no idea what it means. Yes, I know what a script is but there have been no specific suggestions I can see, or no effort to point out exactly how it would work and no examples. Without that, it means nothing to a novice.

>Which means the folder has to exist if all you are doing is a URL rewrite.
Yes, I know that now and thanks for pointing it out. I don't require a forward slash so a hyphen would work nearly as well, avoiding the folder problem. But that does not solve the initial need to change '?id='.

Thanks for taking time to try to explain this as best as you can. It does not address the question about a Pseudo Directory, but I think I've had enough time spent and wasted on EE. I have no plan to return so it would be best for me to just give you the points and close this. Bye.
Top Expert 2014

Thanks for the points.  Hopefully you will read this,

The simple solution to your basic problem/question of

--> But that does not solve the initial need to change '?id='.

You need to write a program.  URL re-write will NOT do it.  I don't think you know/understand as much you think you do, otherwise you would understand why URL re-write does not work.

Good luck in getting what you want accomplished.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial