Wordpress on IIS Cannot Handle 404 File Not Found
I recently found that now Wordpress site hosted on IIS, could not handle 404 File Not Found errors using the standard 404.php page, although it existed. When a request was sent to a non-existant page, users would see a horribleSeriver Error message rather than the nice lovely Wordpress message that I assumed would be set up as standard (only on Apache!).
I found a simple solution for this by setting up a Custom Error to push a 404 error towards the 404.php page that comes with Wordpress, via the Index.php. You may have direct access to IIS, or for example, you are using a hosted service (in my case, dotNetPanel), but the gist of it is to:
1. Access you custom error setup
2. Add a custom error for status code 404
3. Select ‘Execute a URL on this site’
4. Enter /index.php?error=404
The index.php file will contain the code to send the 404 error to the 404.php file.
Related posts: