Custom Http Errors in Wordpress When hosting with Godaddy’s Windows Hosting
The questions I will try to answer in this post of similar to:
- Can I display custom 404 pages in my Wordpress website when hosting with Godaddy using Windows Hosting?
- Can I display Custom pages for any errors in Godaddy’s windows Hosting?
This solution I described here is not limited to Wordpress sites, but can be applied to any Website hosted under Godaddy’s Windows hosting play (Using IIS7)
With IIS7 there a new way that allows you to configure custom error messages for your Web site or application by using <httpErrors> element. To use <httpError> element, create a we.config file under the root directory of your application/website (for example if you Wordpress application is hosted under yourdomain.com\blog, create a web.coinfig file under <yourdomainroot>\blog directory.)
The <httpErrors> element contains a collection of <error> elements, each of which defines an error message that IIS uses to respond to specific HTTP errors
You can add any number of custom custom error messages to IIS by adding an <error> element to the <httpErrors> element in the Web.config file you just created. You can also use the <remove> element to remove a specific error message. If you need more information about <httpErrors> element refer to MSDN documentation here.
Now that you have already created a Web.config file, here is what you should add to the Web.config file. Lets assume that you wish to redirect all the 404 messages to /index.php file, you Web.config should look similar to
Note: You should be hosting your site under IIS7 to use the <httpErrors> element
Also, do not forget to change the 404 error handling in Godaddy Hosting control panel. Here is how you do it.
- Login into your hosting account,.
- Navigate to your Hosting Control Panel
- On the settings page select 404 Error Behavior
- In the 404 pane, select radio button that indicates Make my 404 Page My Home Page and hit ok.
If you need more information about <httpErrors> element refer to following articles on IIS.net site.
To a pretty 404 Error Pages..
Keep watching Ctrl+F5.