Change the Physical Path of Virtual Directory Content (IIS 7)
Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista
When you move the location of a virtual directory's content in the file system, you must also update the physical path in IIS to make sure that users can continue to access the content on the Internet.
For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required for this procedure, see Virtual Directories Feature Requirements (IIS 7).
Exceptions to feature requirements
- Only server administrators can add and edit virtual directories.
To change the physical path of virtual directory content
You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.
To use the UI
Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
In the Connections pane, expand the Sites node in the tree, and then click to select the site in which you want to change the physical path for virtual directory content.
In the Actions pane, click View Virtual Directories.
From the Virtual Directories page, select a virtual directory in the list.
In the Actions pane, click Basic Settings.
In the Physical path box, change the path of the virtual directory content.
To change the path of a virtual directory's content, use the following syntax:
appcmd set vdir /vdir.name:string /physicalPath:string
The variable vdir.namestring is the virtual path of the virtual directory, and physicalPathstring is the physical path of the application's content.
For example, to change the physical path of the location c:\images for a virtual directory named photos in an application named marketing and in a site named contoso, type the following at the command prompt, and then press ENTER:
appcmd set vdir /vdir.name:contoso/marketing/photos /physicalPath:c:\images
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).
The procedure in this topic affects the following configuration elements:
<virtualDirectory> under <application> element
For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.
Use the following WMI classes, methods, or properties to perform this procedure:
- VirtualDirectory.PhysicalPath property
For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.