tags:

views:

347

answers:

2

I have a website that is deployed between 3 different environments - Dev, Stage, and Prod. For Stage and Prod, the site can resolve local paths to images with just the base url to the file, such as /SiteImages/banner.png. However, on the Dev server I have to hard code the full URL of the image path for the image to be resolved, such as http://server/folder/SiteImages/banner.png. Is there a setting I can flip to make the Dev server behave in the same manner as the other 2? I am using IIS 6.0 on a Win 2003 server.

+1  A: 

What does the URL to the dev home page look like? Is it something like http://server/mydevsite/? If so, it sounds like you need to set up a virtual host.

Edit Just to clarify the above, say your prod and stage sites can be simply referenced as http://stagesite/ and http://prodsite/, if you use a path such as /images/myimage.jpg it assumes that the images folder are sitting in the root. In those two instances, no problem, images will display correctly. However, let's say your dev server is like the example I listed above. If your images are references as /images/myimage.jpg, instead of the server looking at http://server/mydevsite/images/myimage.jpg, it will instead look at http://server/images/myimage.jpg. If no images folder with the requested image exist in that server's root, you'll get an error.

Anne Porosoff
+1  A: 

There are usually three kinds of URIs that you can code in a website as far as I know.

  1. Absolute: http://yoursite.com/somehing.jpg

    This url includes the http:// and is the full path to a resouce.

  2. Root Relative: /something/something.jpg

    (In ASP.net server-side only, you would use '~/something/something.jpg')

    This path is relative to the root of your site.

  3. File relative: ../something/something.jpg

    This path starts at the location of the file that includes the URI. In this case, it just back one directory (..) and then goes back into the something directory to look for something.jpg

IAmCodeMonkey
Thanks. The 3rd option worked perfectly.
Mark Struzinski