The HTTP 404, 404 Not Found, and 404 error message is a Hypertext Transfer Protocol (HTTP) standard response code, in computer network communications, to indicate that the client was able to communicate with a given server, but the server could not find what was requested. Showing default 404 Error page is not looking good on IIS Server. Therefore, I will show you how to redirect 404 error page to another page or URL in IIS Server.
Before we continue, you need to verify if the “Web-Http-Errors” Windows feature has been installed/enabled on IIS Server. You can run the command below to verify:
Get-WindowsFeature -Name Web-Http-Errors
If you get the “Web-Http-Errors” Feature not installed yet, you can run the command below to install/enable. This installation will need a server reboot.
Install-WindowsFeature -Name Web-Http-Errors -Restart
How to Redirect 404 Error Page to Another URL
Using IIS Manager
Step 1: Open the Internet Services Manager. The Internet Services Manager is usually located below “Administrative Tools” in your “Programs” list.
Step 2: Expand the list. You can expand the list by selecting the plus sign (+) next to your server name.
Step 3: Expand the web sites in the same way you expanded the server name. Select the Site that you want to configure.
Step 4: Click the “Error Pages” Icon. On the right panel, select “Errors Pages” Icon.
Step 5: Choose the error 404, and then select the “Edit” button.
Step 6: Choose the option that you want. if you want to redirect the error page to another page, you can use the second radio button. If you want to redirect the error page to another URL, you can choose the third radio button and enter the URL.
Step 7: After you’ve selected your page, select “OK” to exit the dialog box.
Once you hit “OK,” your custom 404 error page should be live and doing its job.
You also can change the configuration above through Web.Config. You only need to add the value below on your <system.Webserver> tag.
<httpErrors> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="https://URL/" responseMode="Redirect" /> </httpErrors>