How does ColdFusion resolve filenames? (stupid question???)

Bear with me, I'm new at this (but an experienced programmer).

In the code for a page named send.cfm there is this line:
<cflocation url="view.cfm">
It specifies where to go after inserting a record into a database (if this looks familiar, yes, it's from the tutorial that comes with DreamWeaver).

On my site, the files send.cfm and view.cfm reside in the same subdirectory on the site.
(To be exact, for my test server, they are in c:\CFusionMX7\wwwroot\MyTestSite\contact\coldfusion)

Now instead of going to the view.cfm page after inserting a record, I want to go to another page, named thankyou.html. That file is in the root folder for my site, specifically, it is in c:\CFusionMX7\wwwroot\MyTestSite

I cannot for the life of me figure out how to get it to find the file!
I have tried:
<cflocation url="thankyou.html">  (which I didn't think you work anyways, and it didn't)
<cflocation url="/thankyou.html">
<cflocation url="//thankyou.html">
<cflocation url="#thankyou.html">   (by now I am grasping at straws!)
<cflocation url=".thankyou.html">  

If I open a browser window and type in this address:
I can get to it just fine.

I've tried finding the answer in the Getting Started manual for Dreamweaver and in the help but I'm coming up empty!

If I put the file in c:\CFusionMX7\wwwroot\MyTestSite\contact\coldfusion and use the statement <cflocation url="thankyou.html">  it all works fine, of course! But I don't want to put the file there!)

What the heck is the correct way to tell it to go back to the root to find this file?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this: <cflocation url="../thankyou.html">  
alicia1234Author Commented:
danrosenthal: thanks, but it didn't work. I even checked the code on my test server to be sure the change got up there. Here is exactly what's in the code on the test server (I copied and pasted here):

<cflocation url="../thankyou.html">

also tried ./thankyou.html and

no dice.
I did some testing and there was some funky caching going on. Try changing the name of the page that contains the CFLOCATION and see if that works (not thankyou.html). I tested the code I posted and you re-posted and verified that it works just fine.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

alicia1234Author Commented:
I made a copy of the page send.cfm ... the one that contains the CFLOCATION command.
Then I previewed it in browser ... I still get the file not found thing when it tries to access "../thankyou.html"
I did verify that my stest server does have "../thankyou.html"
alicia1234Author Commented:
Based on your comments, I tried some more things. In the process, I stumbled upon the user interface to change this parameter ... through Applications panel, Server Behaviors ... I double-clicked the item "Insert Record (form1, connAlicia, COMMENTS)" and got to the screen where I could browse for the "After inserting, go to" location.
I browsed to my thankyou.html file, and Dreamweave resolved it as "../../thankyou.html".
So I cancelled out and then went in to edit the code for the page to change the statement to
<cflocation url="../../thankyou.html">
I did a Preview in Browser and it asked about uploading files and I said to do it.
I still got the file not found error.
BUT ... then I went to the Files panel and did a "Put File(s)" from there.
Then it all worked fine.
So there does indeed seem to be some funny caching stuff going on.
However ... it does turn out that the syntax with ../../thankyou.html was the correct one.
Can you explain why?


<cflocation ...> uses absolute and relative URLs rather than physical paths.

If your page with the cflocation in it is at /CafeAlica_1/contact/coldfusion and the page you want to location to is in /CafeAlica_1 then you either need to go back up 2 folder levels eg ../../  or you need to use /CafeAlica_1, so that it know to redirect to a page in the virtual directory "CafeAlica_1" at the top level of the site.

<cflocation url="thankyou.html">  would look in the same folder as the calling template
<cflocation url="/thankyou.html"> would look in the very top level of the site get http://localhost:8500/
<cflocation url="//thankyou.html"> is invalid, but would probably still look in the top level of the site.
<cflocation url="#thankyou.html"> would try to go to an anchor called "thankyou.html" in the current page (maybe)
<cflocation url=".thankyou.html">  would look for a file call ".thankyou.html" in the current folder
<cflocation url="../thankyou.html"> would look in the folder above the calling template.
<cflocation url="../../thankyou.html"> looks two folders above the calling template
<cflocation url="/CafeAlica_1/thankyou.html"> is an absolute path to the template thankyou.html

Hope this helps


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.