CF standalone server mapping problem

I use CFMX7 standlone server locally for testing. My problem is that it does not properly recognize site roots. I have set up this mapping for the root in the CF administrator:

Logical path: /

Directory path: C:\CFusionMX7\wwwroot

Everything works fine when I use relative paths in my sites. But CF does not find absolute paths correctly.

So if I try to use this link in mysite1, for example:

<a href="/index.cfm">link</a>

I get this: http://localhost:8500/index.cfm

When I need this: http://localhost:8500/mysite1/index.cfm

I have located the files for mysite1 in c:\cfusionmx7\wwwroot\mysite1

This happens with all my CF sites. It's driving me crazy. I have used a workaround in the past by declaring #application.rootfolder# in Application.cfc and then adjusting the value for the testing and production servers, but for the site I'm working on now it's not feasible. I want to use a number of included files, including an included header and footer placed by Application.cfc, and it's way too complicated to keep using this workaround. The absolute URLs work on my production server, but obviously I need to be able to test and debug locally.

I'm running Windows 2000 locally. The production server is Windows 2003. Don't know if that makes a difference.
Who is Participating?
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.

I have never used the cfmx standalone server, but it seems to me that someone said once that they setup different sites under it.
Then of course you'd setup site1's home directory as C:\CFusionMX7\wwwroot\site1
and site2 as C:\CFusionMX7\wwwroot\site2 etc
Then your link "/index.cfm" will work.

Look for this in your cf admin settings

I'll post back if I find more info
brucecrabtreeAuthor Commented:
Yes, I have multiple sites defined within the wwwroot folder. The problem is that it's not correctly finding root-relative links within any of those sites (I said absolute above -- should have said root-relative).
What does it say under site1 (for ex) Home Directory? This is important.
Also, Do you have your application name (in your cfapplication tag) set to a unique value for all sites?
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

brucecrabtreeAuthor Commented:
>>>What does it say under site1 (for ex) Home Directory? This is important.

I'm not sure what you mean by this. Are you asking about something in the CF admin?  

Yes, I have a unique application name set up for each site.
Yes - in the cf admin ??? I imagine - somewhere
As I said I've never used the standalone server.
On IIS you simply open site properties and on the Home Directory tab - you specify the path to the site.
It must be something like this.
brucecrabtreeAuthor Commented:
There is no similar setting in the CF administrator as far as I can see. You're simply supposed to set a mapping for the web root and then place each site in its own folder in that directory.
OK - Well that is the problem.
There needs to be some way to differentiate one site from another.
a link or include can only define "/index.cfm" (for ex.) as being in relation to something.
A webserver defines it as being in the top level folder of the website in question.
This could simply be a limitation of using the standalone server.

You had mentioned using a localpath var - you might want to reexplore that if there isn't a way to create different sites.
Except that don't make it an application var - just create a var named localPath (for ex)
cfset localPath="/mysite1"
and use it like
a href="#localPath#/index.cfm"
When application hits a real server and your application resides in the website top directory then all you need to change is
cfset localPath=""
and use it like
a href="#localPath#/index.cfm" which is the same as before

This method may actually come in handy for you someday.
You can then write code for sale where the purchaser can simply copy & paste your folder into their site and set their own localPath.

Or whatever ...

good luck
brucecrabtreeAuthor Commented:
That is essentially what I've done. I just set  the variable once, in Application.cfc, and called it application.rootfolder. But it's too much of a headache in the project I'm working on now to add #application.rootfolder# in front of every url. Maybe it is simply a limitation of the standalone server -- except, I tried setting the web root to the specific site's directory, but it still won't work. So I think I'm missing something.
Is this change something that requires a restart of CF?

Shorten your var - change to something unique like "locP"
Do an extended search for that 4 letter string anywhere in your app beforehand to avoid searching problems in the future.
And like I said - take it out of the application scope. just make it a var as in
<cfset locP="/yourpath">
Put this in your Application.cfc and you're off and running.

You don't (or shouldn't) have to put in on every url or include.
Only those that are not in the top level dir and where you need the application to know that the linked to file is in the top level directory

good luck
brucecrabtreeAuthor Commented:
I understand what you're saying, and I've done that before on other projects. But the site I'm working on now is too complex for that. It has a large js menu system with internal icons, and many folders and subfolders. So it would require placing the variable in front of lots and lots of links, not only to page files but also to images, stylesheets, and js files -- in short, it's too much of a headache, and it feels like something I shouldn't have to do. Root-relative links should work! I may have to resort to reinstalling CF -- maybe that will help. Anyway, thanks for your suggestions. I'll keep looking to see what's keeping the CF standalone server from getting those links right.
That actually is the best idea.
Maybe it is a faulty install???
I just suggested this because you had done similar and I thought that there is a possibility that thats just the way it is.

Does the port you're using have any affect? Can you switch to port 80? Just to experiment.
Are you still having trouble here?
brucecrabtreeAuthor Commented:
I've posted this question in a few forums, and what I'm hearing is that this is simply a limitation of the CF built-in server. So for now I am just using the <base> HTML tag as a workaround, although it is a less desirable option than using root-relative links. What I need to do for the long term is to set up my CF development server to work with IIS instead of using the built-in server. Thanks for your suggestions.
Anytime Bruce
I consider myself lucky to have a full-blown development environment - complete with DNS!
There is no other way to develop.

I would appreciate the points on this one, cause I did say that this may be a limitation of the built in server,
but it's up to you.

Good luck

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
brucecrabtreeAuthor Commented:
Done. Thanks agian.
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.