Link to home
Avatar of MFredin
MFredinFlag for United States of America

asked on

Simple directory question

I don't know if this is the right area for this question but here goes...
I have a few folders setup in my wwwroot directory for different sites I am running on a testing server. I use direct paths for my links... example: (/site1/images/image1.jpg).  When I upload these files to my live webserver, the root folder doesn't include the /site1/ directory so it bombs out.  I don't want to have to create an extra directory named /site1/ on my webserver just to make it work.  How would I make this work so I can use direct paths on my testing and web server with out having to change them when I upload?
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

You should set your local root folder to include the /site1/.  Then it will start looking in /images/
Avatar of MFredin


I have the /site1/ folder in the wwwroot directory.  The direct path on the server would be D:/inetpub/wwwroot/site1/images/image1.jpg.  What would I change here to make it start looking in the /images/ folder?
What is your LOCAL site definition root folder?
Avatar of MFredin


My LOCAL root folder does include the /site1/ folder.  I have a mapped drive to my wwwroot folder on my test server (T:)  It looks like this in Dreamweaver...  (Local Root Folder: T:\site1\)  So my site opens up right into that directory.  
So when you connect to the remote site, does the folder view look the same in both panels of the site window?

In other words, you want to mirror the path setup on the local and remote site so that the DW see the publicly available pages as the top level.

If the Local Root Folder is T:\site1\ and you see something like:


Then your Remote Path should be D:/inetpub/wwwroot/site1/

and you should roughly the same listing.  If so, when you insert files, links, or images, DW should create the correct paths.

If everything is correct and DW is not creating the correct paths, then you may need to recreate the site cache.
Avatar of MFredin


Ok here are my DW settings.  I am using DW MX 2004.  

(W:) is mapped to \\Server1\Inetpub\wwwroot\

--> Local root folder: (W:\site1\)
--> Default images folder: (W:\site1\images)

--> Access: (Local/Network)
--> Remote folder: (W:\site1\)

--> Testing server folder:(W:\site1\)
--> URL Prefix: (http://Server1/site1/)

Here is my basic (W:\site1\)

Those are my settings.  Now say I am at the root of my site (W:\site1). I then have a /images folder where I keep my header image (/images/header1.gif).  I include this image in my header as <img src="./images/header1.gif">.  When I open a file directly off the root, say index.cfm my header displays fine.  Now say I go one directory in to /public/contactus.cfm now the header can't find the file?
Try it as:

<img src="../images/header1.gif">
Avatar of MFredin


That works fine when I'm in a subdirectory... /public/contactus.cfm.  But when I'm at the root it takes me out of the root directory and doesn't include it...  heres the path I get when I view the properties of the header from my index.cfm page, which is at the root.  http://Server1/images/header1.gif.  It should be http://Server1/Site1/images/header1.gif.  It's like it doesn't know that /site1/ is the root.
Okay, I think the problem is with the way the site is set up on the server (in other words, not a DW problem).  The ../ command shouldn't back up you past the public root folder, which appears to be Server1.  It should be set to site1.

Did you set up the hosting or is this an ISP?
Avatar of MFredin


I have it setup in IIS.
Okay, as far as IIS thinks, your site root is \\Server1\Inetpub\wwwroot\

The problem with setting things up the way you have them is that the site root folder is important if you use document relative or site relative paths.  Because the server sees a different site root than what you have defined in DW, eventually the paths fail.
Avatar of MFredin


So what would you recommend?  If I set the root as \site1\ then my other sites won't work.
I think you should try to set your local site definition one directory level higher and code things including the site1, site2 etc folders.  So long as the root levels are the same, site root relative links should work.
Avatar of MFredin


But then it doesn't work when I move the files to my live site, which is hosted by a hosting company.  The root directory doesn't include the \site1\ directory on the hosting server.
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial