views:

82

answers:

1

So for development purposes, we had our folder structure for our website something like this... web/testing/companyName/current/index.aspx. Web is the root folder.

Now, we are about to get finished with the website, and I was wondering how should we move it up?! We have even hardcoded things like "../current/index.aspx" (for relative paths) and "~/testing/companyName/current/index.aspx" (for absolute paths)

so how should we approach this?

+1  A: 

From this point forward, I'd try to keep both the development and production versions of the site in a root directory. Don't put a new web project in a subfolder of an existing site and work with it there. Instead, take the time to actually set up a new website in IIS that references the working directory directly. You can do that with host headers (utilizing subdomains perhaps), or even using different ports if you'd like. For example, for your "development" version of the site on your local network you may refer to it as http://yourdomain.yournetwork.local/ or perhaps something like http://servername:1234/ if you want to simply use ports. And the "live" version of the site would be http://www.yourdomain.com/.

This way as you move the site between different environments, it'll still work with the same relative linking schemes. So once you get this set up I'd go through the site with your IDE or text editor of choice and replace the old links with the new consistently formatted links. I've used the "Replace All" feature in Visual Studio for this in the past with success, although you definitely have to be careful with it.

Going forward I would use the format of href="/current" most of the time. And instead of referencing images as src="images/a.gif" then put the forward slash in there as src="/images/a.gif". Including that forward slash at the beginning is a shorthand way of creating absolute links without actually specifying the domain. In the long run I've found that this can prevent mistakes while also having the benefit of working from any domain or subdomain you might have set up. For what it's worth, if you look at their HTML you'll notice that even StackOverflow has adopted this linking structure.

When you're all done, double check your work with the W3C link checker.

Steve Wortham