My website will be down for maintenance for some time, and I want to make sure sure that (1) search engines see a HTTP 503 error code for every page, and (2) humans see a friendly message describing the downtime, in line with downtime SEO best practices.
How do I set up IIS 7.5 such that every request gets a custom 503 error message?
One way is to use the Url-Rewrite extension.
You can then use a rule like this to catch all requests:
This takes care of the Search Engines, for the users you can add the following:
and then put a 503.html file in the root of your site which has a nice error message. Because you can not use styles or images in the page that are on the site itself, you need to link to another site or put all styles and images inline in the html page.
If one's using a .NET application with IIS, one can also use an app_offline.htm file to shut down an application and prevent pages from being requested with an appropriate 503 error code.
You can setup a web.config in the following and put it in your root directory.