Devil Raily
Devil Raily

Reputation: 562

Landing page throws 404 error but inside pages works

When I type the URL as www.example.com, it throws the following error message.

404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

but when I type the URL as www.example.com/index.cfm, it works. Please advise what can be the problem and how can I solve this issue.

When I open the URL www.example.com from the server, it throws different error message.

HTTP Error 404.17 - Not Found The requested content appears to be script and will not be served by the static file handler.

Upvotes: 1

Views: 319

Answers (1)

Piper McCorkle
Piper McCorkle

Reputation: 1074

TechNet has an article on this, what you want to do is add a default document. By default IIS doesn't look for .cfm files as "default" files like index.html, so you have to configure it to do that.

From TechNet:

With the GUI

  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).
  2. In Features View, double-click Default Document.
  3. In the Actions pane, click Add.
  4. In the Name box, type the file name that you want to add to the list of default documents and then click OK. This file name will be added to the top of the default document list.
  5. Optionally, select a default document in the list and in the Actions pane, click Move Up or Move Down to change the file's precedence.
  6. Optionally, select a default document in the list, and in the Actions pane, click Remove to remove any file names that you do not want to use as default documents.

With the CLI

To add a file name to the list of default documents, use the following syntax:

appcmd set config /section:defaultDocument /+files.[value=' string ']

The variable string is the file name that you want to add to the list. For example, to add a file named home.html to the default document list, type the following at the command prompt, and then press ENTER:

appcmd set config /section:defaultDocument /+files.[value=' home.html ']

To remove a file named home.html from the default document list, type the following at the command prompt, and then press ENTER:

appcmd set config /section:defaultDocument /-files.[value=' home.html ']

For more information about Appcmd.exe, see Appcmd.exe (IIS 7).

Upvotes: 6

Related Questions