Avatar of MFredin
MFredin
Flag 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?
Adobe Dreamweaver

Avatar of undefined
Last Comment
Jason C. Levine

8/22/2022 - Mon
Jason C. Levine

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

ASKER
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?
Jason C. Levine

What is your LOCAL site definition root folder?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
MFredin

ASKER
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.  
Jason C. Levine

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:

\images
\otherfolder
\anotherfolder
index.html
page1.html
page2.html

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.
MFredin

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

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

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

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

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

Here is my basic structure...in (W:\site1\)
\images
\public
index.cfm
header.cfm
footer.cfm

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?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jason C. Levine

Try it as:

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

ASKER
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.
Jason C. Levine

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?
Your help has saved me hundreds of hours of internet surfing.
fblack61
MFredin

ASKER
I have it setup in IIS.
Jason C. Levine

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.
MFredin

ASKER
So what would you recommend?  If I set the root as \site1\ then my other sites won't work.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jason C. Levine

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.
MFredin

ASKER
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.
ASKER CERTIFIED SOLUTION
Jason C. Levine

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question