Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A customer created a virtual directory as a sub-directory of another virtual directory (then wondered why his URL's weren't working!) Is there some way for me to move the new virtual directory to the "root" of the web site? Do I have to delete it and recreate it?

Again, this is IIS6.

share|improve this question
up vote 1 down vote accepted

I do not believe there are any scripts to move a virtual directory.

I believe that any sort of script to do this will simply copy the properties to a variable, delete the original and create the new one from the stored variables.

It should not take you that long to create... You can create the new one before deleting the old one to make sure it works.

Just go to IIS, click the site, right click and then new > Virtual directory.

share|improve this answer
Unfortunately, I'm no IIS scripting whiz kid. Can you point me to an example script that does this? – GuyBehindtheGuy Jul 30 '09 at 14:58
I can't point you to a script off by heart, but my method doesn't require any script it is all via gui. look at my last line - if you still need help, tell me and I will try to re-phrase it – William Hilsum Jul 30 '09 at 20:42

A virtual directory is a pointer to a physical directory. That means you can have multiple virtual directories in different web sites which point to the same physical folder.

If the customer created the folder as virtual directory (and not as physical folder in the physical folder of the "main" virtual directory) there is no problem. Just recreate the virtual directory pointing to the right physical folder.

If your customer created a physical folder in the wrong directory, I would copy the folder to the right place before recreating the virtual directory. Physical folders can change things in web.config files if they are nested.

share|improve this answer

There is no way to move the Virtual Directory. If it were me I'd create the new one in the right place then delete the one that is in the wrong place.

If the data is in the wrong place as well I'd move that very carefully. But changing the virtual directories should be pretty easy.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.