0

we are currently using IIS 8 on our new windows VPS. We have a content management system we install for all our apps we build, but we are finding it incredibly painful as our hosting provider requires that we change the default 404 error page from the default settings everytime we create a site.

Is there an easy way within IIS to automatically apply this same default directory within each website so we dont need to edit it on every website we build ?

thanks in advance

user125264
  • 101
  • 3

1 Answers1

0

There are three main locations in IIS7+ where you can define the error pages.

A. On the server level for all sites, (in ApplicationHost.config system.applicationHost/httpErrors)

B. On the site level, stored in ApplicationHost.config location system.webServer httpErrors

C. On the site level, but stored in web.config system.webServer httpErrors

How you can define your error pages depends on your permissions and the setup of the server.

If you are an administrator and want to affect all sites on the server, it is easiest to set the error page on a server level.

If you need to set error pages on a per site basis and Feature Delegation for 'Error Pages' is set to 'Read/Write', you can just have an httpErrors section in your web.config. Assuming you have a template for your web.configs, any new site will get these settings automatically.

If feature delegation for 'Error Pages' is read only, you can not have these settings in your web.config. In this case, you must change ApplicationHost.config, rather than using the gui, you should create a script to set your error pages for a site and then run this script whenever you create a new site. If you are creating many sites, it makes sense to create the whole site with the same script.

Peter Hahndorf
  • 13,763
  • 3
  • 37
  • 58