Make sure you read part I before enbarking on this second entry. For those of you who have read part I and are wondering what do I do next? Read on…
Virtual Directories
That is everything you need to know for customising the root directory. But that’s just the properties options. Next we are going to create a directory so that the folder ‘work’ will be mapped to a completely different directory. First close the properties box and bring to focus the Management Console if it isn’t already. Then find the root icon again. Now right click it and hover over the new > link. This should bring up a new link with an option that says ‘virtual directory.’ Click it and wait for the wizard to open.
Click next to skip past the welcome screen and you will be greeted with a box asking you to select an alias. This is simply a name for the directory which will be used. In this example we are using ‘work’ so write work into the box and click next. This means that it will be accessed from http://locahost/work. Next we are asked for a directory. If this is going to be a redirect then just add any directory and change it later. However if say you wanted to map this to My Documents then click browse and find My Documents. Click it and then click OK. The path will then be entered into the box for you.
Now click next again and you will be brought to the permissions screen. This is where you set the permissions and what can happen. Normally you can just click next again to pass it but this time check the box which says browse. Now click next again and finally click the finish button on the next screen to close the wizard. The directory has been created and can be seen on the list as a branch of ‘root.’
Now its time to test the new directory – open up your browser and point it to http://localhost/work so that the page loads up. This should, if you have done it correctly, bring up a list of all the files in you’re my Documents folder. Congratulations if it worked you have a virtual directory. If not then make sure you can find the directory under root and make sure the path to My Documents is correct.
Next go back to the Management Console and click root on the left. This should bring up a list of all the files and virtual directories on the right in the big box. In this box you should now find ‘work’ next to a little grey box icon. Right click on it and click properties. This will bring up a properties box named after the virtual directory.
The default selected tab on here is Virtual Directory. This basically does the same job as the Home Directory tab when we had the properties page for root on screen. The other tabs also match up to the tabs on the root properties although there are not as many as you do not have the settings for the entire site on top of the directory settings like you do when you are editing the properties of the root site.
Redirects
Finally I want to cover one more thing – setting up a virtual directory to do a redirect. To do this select Virtual Directory from the list of tabs in the properties for ‘work’ and find ‘a redirect to a URL’ from the list of bullet options at the top. Click this and all the directory information disappears to make way for redirect information.
The top box is where you enter a URL for it to redirect to. This can be a virtual directory on your computer although you cannot redirect it straight to a file. So if you wanted to link it to something in your unzipped folder on your hard drive you would have to set up a virtual directory which is set to your unzipped folder.
Here is my example. I have my directory http://localhost/work/ and the redirection URL I have entered is http://www.mworld.us/entertainment/fake.asp. If I enter this URL and don’t tick any boxes, when I enter in the address to my directory it will be replaced in the address bar by the direct URL which will go to the exact address I entered – and in this case bring up a 404 error page seen as the address is not real. The same happens if I have the box ticked saying ‘the exact URL entered above.’
However if I tick the box ‘a directory below this one’ the directory will remain in the will remain in the address bar as if it is the original directory. So I could reduce the address of http://localhost/files/folders/stuff/complext/somefile.php? variable1=somevalue&variable2=othervalue to http://localhost/somefile and it would display the same file but users would see http://localhost/somefile in their browsers.
The final tick box is ‘a permanent redirect for this resource,’ Normally redirects such as the above are temporary as the file is still in the other location and you are just masking it However if the file has moved and you want to set up a redirect to another location so your users can find it, that is when you tick the box to say – never come back to this redirect address, always use the address its redirecting to.
Final Tasks
Right, that’s done. If you don’t want that directory hanging around any more then close the properties window if it is still active and find the directory in the list in the Management Console. Then right click its name and click delete to remove it.
There is one more important thing which you will probably use when using Internet Information services. That is stopping and starting your website. If you click root again in the tree view on the left you will notice three black buttons at the top become click able. These allow you to stop, start and pause your web server. The web server only works when it is running. So if you don’t want it running then click stop. Click start again when you want to reactivate it. This is useful when your server stops delivery pages because it’s moaning of ‘heavy traffic.’ If this is the case click stop, pause for a second or two then click start again.
Conclusion
Hopefully this should get you started with the basics of internet information services. There is lots of fun to be had experimenting and playing about with the different settings so my advice is just have fun and see what you can do.
Don't have time to check my blog? Get a weekly email with all the new posts. This is my personal blog, so obviously it is 100% spam free.
Tags: configuration, iis, web server
This entry was posted on Sunday, September 16th, 2007 at 1:54 pm and is filed under Life, Tech. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.