Yes, with the custom error pages created and the code in the web.config file, the application will automatically redirect to the custom pages according to the error, regardless of the server the application is being hosted on.
When an error occurs, the ASP.NET runtime looks for the <httpErrors> element in the web.config file and reads the configuration specified for the error codes. The <httpErrors> element specifies how to handle errors that occur during HTTP requests to the application. The errorMode attribute determines whether to display the errors to the client or hide them from the client. If the errorMode attribute is set to "Custom", the <httpErrors> element will redirect the client to the custom error pages specified in the <error> element for the corresponding HTTP error status code.
Therefore, as long as the web.config file is deployed with the application, and the custom error pages are available, the application will automatically redirect to the custom error pages according to the error, regardless of the server the application is being hosted on.
Please, if this answer is helpful, click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please let me know.