Renaming Websites and Folders in WebMatrix
Using a free package it is possible to develop a website on Windows using Microsoft WebMatrix. This program allows you to run a website on your local Windows computer. When a website is created in WebMatrix it will usually have the name EmptySiteX where X is a number. The name is the same as the folder in which the website files are stored. Where does WebMatrix create this folder? This folder is normally in My Web Sites in the logged on user’s Documents folder:
C:\Users\John Doe\Documents\My Web Sites\EmptySite1
(Tip: Using the WebMatrix settings this default location can be changed.)
Changing a website name in WebMatrix is easy. Open the website in WebMatrix with the Home tab selected. Ensure site folder is visible (select Files or the files icon on the left hand panel to see everything that makes up the site). Bring up the context menu (usually right-click) on the top level folder. Select Rename and enter the new name:
A brief status message is displayed at the bottom of WebMatrix. Then to completed the WebMatrix rename site an edit of the IIS Express applicationhost.config file is required.This is because the folder rename in WebMatrix does not change the virtual folder name. What is IIS Express and the virtual folder? IIS Express is the lightweight version of Microsoft’s Internet Information Services (IIS). IIS is used as the web server on Windows PCs to run websites. The virtual folder is the location that IIS looks for the website files. Changing the virtual folder name to match the website name is done outside of WebMatrix.
Complete the WebMatrix Rename Site Process
Close WebMatrix, use the File menu and select Exit. Using Windows File Explorer go to the site’s virtual folder in the My Web Sites directory. Rename the EmpytSiteX folder to the new name. Now go to the user’s IIS Express configuration directory. This is normally under the user’s Documents folder, e.g.:
Edit the file applicationhost.config, this can be done with the Windows built-in Notepad or another text editor. Scroll down about 150 lines to find the <sites> section. Locate the section for the newly named web site. It will start <site name=”new-name”… where new-name is the name you gave the site in WebMatrix (or search for new-name). Change the physicalpath entry to match the new virtual folder name in the <virtualDirectory… setting.
<site name="new-name" id="1234567890">
<virtualDirectory path="/" physicalPath="C:\Users\John Doe\Documents\My Web Sites\new-name" />
<binding protocol="http" bindingInformation="*:1234:localhost" />
Save the applicationhost.config file and go back into WebMatrix. This completes the WebMatrix rename site process. The name in WebMatrix, the folder and the IIS Express configuration are now all the same. For more information on WebMatrix see the Microsoft WebMatrix Home Page.