Site hosting news, tutorials, tips, How Tos and more

Configuring a Default Document

howto

Here’s another tip for those who are new to web hosting or Windows web hosting.  Under Windows/IIS, you can specify the default web page that will load up when you enter your site’s domain name.  We have preconfigured IIS to automatically load one of these files:

index.html, index.htm, index.asp, default.html, default.htm, default.asp, default.aspx,  winhostdefault.htm

And here are the instructions to change these settings:

1. Download and install IIS7 Manager from Microsoft: http://www.iis.net/download/iismanager

2. Configure IIS7 Manager to access your site account.  You can follow the instructions in this Knowledge Base article.

Or follow the steps below:

A. Select File -> Connect to a Site…

B. Enter the Server name and Site name.  This information can be found in the Winhost Control Panel.
C. Enter the User name and Password for your site.

3. You will now see a number of delegated modules.  Double click on the Default Document module.

4. To add a page to the Default Document list, click on the Add… link.

5. Here, I have added a page named homepage.html to the list.

The page that automatically loads is determined by rank from top to bottom.  This means if IIS cannot find a homepage.html, it will look for index.htm next and go down the list until the list is exhausted.  You can use the Move Up and Move Down links (indicated by the green arrows) to change the rank order.  Consequently, you can also Remove pages you do not wish to be on the list.

As a final note, I’ve shown you how to configure the Default Document for the root of your site.  You can also configure the Default Document for any subdirectory by selecting it on your left, and then double clicking the Default Document module.  Please note that all changes are written immediately to the web.config file in the appropriate directory on the server, and if you know the web.config file well enough, you can also manually add the XML entries using any text editor.


11 Responses
  • Niall O Broin Reply

    The above is incorrect. I just set up Open Cart on Winhost for a friend and in order to have index.php served as the default document, I had to learn more about the web.config file format than I ever wanted to know.

    • Hank Reply

      There may be some specific issues when configuring OpenCart, I’m not sure, but that’s always possible with any third-party application. But those issues don’t make the above tutorial incorrect.

      As you know, in php, asp or asp.net, there are always more than one (or two or three) different ways to do the same thing.

  • Rei Tu Reply

    These instructions will work for any “traditional” website which does not involve routing like MVC or redirects. I also just setup a base install of OpenCart on a test account. I went through the install process and did not have to configure a Default Document. Index.php was loaded automatically.

    • Niall O Broin Reply

      Rei – perhaps your install of OpenCart was on a different server than mine which has a different configuration of IIS? Like you, I did a standard install of OpenCart (which I might add, took WAAAY longer than it should due to Winhosts’s ridiculous refusal to provide any means of expanding ZIP files on the server)leaving me with a directory listing like this (trimmed so it wouldn’t wrap here and be a mess):

      drwxrwxrwx admin
      drwxrwxrwx catalog
      -rwxrwxrwx config.php
      drwxrwxrwx download
      drwxrwxrwx image
      -rwxrwxrwx index.php
      -rwxrwxrwx php.ini
      drwxrwxrwx system
      -rwxrwxrwx web.config

      The web.config file is all that’s different from a standard install, and without it, when I connect to the website, I get a directory listing. Go figure. If anybody from Winhost reads this and cares to check (because it must be a misconfiguration of IIS on that server that it doesn’t behave as it should) the server is w08 and the Winhost username is 0020471

  • Rei Tu Reply

    Your website looks fine. It’s working with the web.config file. I noticed you haven’t changed your name servers. It’s not pointing to Winhost, so if you’re trying to access your site using your domain name, then that might explain why you are not getting the correct results. We provide a Secondary URL address in the Control Panel you can use to test/preview your site prior to pointing your domain name over to us. Check that URL, and you’ll see that everything is working.

    • Niall O Broin Reply

      Yes, I know the website looks fine and is working with the web.config file. The point is that according to what you said above, the web.config file should not be necessary.

      As to the name servers, don’t mention the war 🙁

      The name servers are however configured correctly so the server is available on both names – and even if it weren’t, that could have no impact on the need for a web.config file to serve index.php by default.

  • Hank Reply

    Niall,

    Two things by way of clarification. First; “Winhosts’s ridiculous refusal to provide any means of expanding ZIP files on the server” – we’ll unzip files for you on the server. But it’s a manual process, so you have to go through support. Typically you can upload individual files in less time than it would take to have us decompress the zip for you.

    In order to maintain security on the servers – and keep your site safe from the intentional or unintentionally damaging actions of others – we block the upload of certain types of files. As every shared host does. Allowing customers to decompress archives on the server would circumvent that security. Security never makes things more convenient, but it’s necessary, as I’m sure you would agree.

    Second, when your name servers do not point to us it makes troubleshooting difficult, since we don’t know how your DNS is configured. You say it’s correct, and I’m sure it is, but that doesn’t change the fact that trying to provide support for issues like yours when a large part of the equation is not available to us makes it difficult to determine what the cause of certain specific problems might be.

    Just a couple of things to bear in mind when you are frustrated with a problem. We are here to help, though in some cases it isn’t possible for that help to be as comprehensive as everyone would like.

    • Niall O Broin Reply

      I’m going to reply to this twice, as there are two very separate issues.

      I sit corrected that it’s not possible to have files unzipped but frankly, having to ask support to do this is ~= not having the facility at all.

      I don’t have a lot of experience with Windows shared hosting but I have used control panels on other Windows hosters which allowed unzipping files, and it is a LOT more convenient, and very much faster, than unzippping a file locally and then having an FTP client upload thousands of files individually

      Of course as a Windows hoster you need to be very concerned about security, but if you use some kind of scan on write system, that can surely work just as well on zip file extract as on FTP upload.

      In the end of the day, of course, it’s your football so . . .

      • Hank Reply

        “but if you use some kind of scan on write system, that can surely work just as well on zip file extract as on FTP upload.”

        The filetype blocks are native to the FTP service, so there is no overhead associated with them. I think a “scan on write” could be an unnecessary memory burden on a shared server with hundreds of users. As is unzipping an archive, which is another reason we don’t allow it.

        I understand that your experience at other Windows hosts may have differed from Winhost. I can point to several hosts with “user-friendly” policies that are frankly asinine and dangerous. They do those things because they don’t want to say ‘no’ to a customer for any reason, or they don’t want to take the time to explain why something may not be a good idea. I would rather explain than take people’s money and host them on a ticking time bomb. Different philosophies.

        I spoke to Rei and he told me that you are absolutely correct about w08, that it was misconfigured and index.php wasn’t in the global default document list when you were having your configuration issues. That’s our mistake, and I’m really sorry that you had to go to unnecessary lengths to get index.php to work.

        We owe you one for that, sorry Niall.

  • Niall O Broin Reply

    The mention of DNS servers is a complete red herring. My complaint was that index.php is NOT automatically served as a default document. This has NOTHING to do with DNS and applies whether I use my own domain’s name or the Winhost alternative name.

    Your documentation says index.php WILL be served as a default document, and Rei said that s/he did an install of OpenCart on a test account and the index.php was served as default document automatically. Nonetheless, this is NOT the case on w08 where I could only get index.php to work by creating an appropriate web.config file.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.