Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

CF standalone server mapping problem

Posted on 2006-03-22
15
Medium Priority
?
159 Views
Last Modified: 2013-12-24
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.
0
Comment
Question by:brucecrabtree
  • 8
  • 7
15 Comments
 
LVL 25

Expert Comment

by:dgrafx
ID: 16258413
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
0
 

Author Comment

by:brucecrabtree
ID: 16258870
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).
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 16259119
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?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:brucecrabtree
ID: 16259262
>>>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.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 16259484
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.
0
 

Author Comment

by:brucecrabtree
ID: 16262782
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.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 16263399
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
0
 

Author Comment

by:brucecrabtree
ID: 16264304
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.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 16264407
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
0
 

Author Comment

by:brucecrabtree
ID: 16264476
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.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 16264551
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.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 16341965
Are you still having trouble here?
0
 

Author Comment

by:brucecrabtree
ID: 16342426
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.
0
 
LVL 25

Accepted Solution

by:
dgrafx earned 2000 total points
ID: 16342642
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
0
 

Author Comment

by:brucecrabtree
ID: 16342738
Done. Thanks agian.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question