Wednesday, January 13, 2010

SharePoint: How to Move Default Virtual Directory/Site Path Location (Site and Central Administration)

I have encountered requirement to move all the virtual directories to non-system drive. By just removing the default location from C:\inetpub\wwwroot\wss\virtualdirectories\xx to another drive and set the path in IIS will not solve the problem, somehow SharePoint keeps their own path to the original location, and displays some critical error instead.

So the solution is to update the WebApplication to point to the new Virtual Directory location. Luckily, I found this blog that teaches how exactly to do this. So I just create a simple console application that can be executed (using Farm Administrator) from command prompt, e.g. ChangeDefaultDirectory.exe "http://site:80" "Default" "D:\inetpub\WSS\VirtualDirectories\80". And after IISReset, woolahh.. my site are back in action again. This can be used for Central Administration and SSP too. Just be careful with SharePoint Shared Service Provider, you need to use "http://site:xxxx/ssp/admin". For one that needs this simple console, please comment this post with your email, and I will send it to you.

The other things to take note is the default directory of the new Web Application created in SharePoint Central Admin. It might be easily overlooked when you create new Web Application. This blog provides what exactly you need. For IIS7, I found that you only need to change the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp key and modify the PathWWWRoot Value data to D:\Inetpub\vroots. Don't forget to backup your registry before any modification.