phpHostingDeals

CALL NOW!(ID:85470)
+1-855-211-0932
HomeGeneralHow do I setup custom error pages for my website?

How do I setup custom error pages for my website?

Whenever an error occurs on the server, it displays an error page to the visitor with information and tips about the possible cause for the error. These error pages do not match your website's layout and are sometimes too general. You may want to set up your custom error pages, which should be displayed to your visitors whenever an error occurs. There are two methods that could be used to achieve this. 1) Editing the domain/subdomain options in the Hosted Domains section. We have embedded the option to set a custom error page for server errors 400, 401, 403 and 404 inside the Hosted Domains section of your Web Hosting Control Panel (My Domains > Domain Manager > Hosted Domains). Find your domain in the list, right-click on it and choose the "edit" option You are now able to edit the error page options. You should see the following options: Set error 400 page: Set error 401 page: Set error 403 page: Set error 404 page: Initially, all error pages are set to "Default". To set a custom error page, choose "Custom URL" and enter the path to the corresponding error page in the field. If you haven't created one yet, do this first and then get back to the Hosted Domains section to update the settings. 2) Using .htaccess Just like with the first method, which is described above, you must create the corresponding error page(s) first. When ready, open the File Manager section of your Hosting Control Panel (Files > File Manager) and navigate to your domain/subdomain folder - it usually has the same name as your domain/subdomain and is located inside the www/ directory. Inside the domain folder create an empty file called .htaccess using the form located at the top of the File Manager section. Then edit the .htaccess file with the plain-text editor and insert the following code:
ErrorDocument 400 /custom400.html
ErrorDocument 401 /custom401.html
ErrorDocument 403 /custom403.html
ErrorDocument 404 /custom404.html
In the above example the custom 404 error page is located in the same folder as the .htaccess file and it is called custom400.html. Edit the path and the name of each page accordingly to reflect the actual names and location of your custom error pages. This method would work no matter what the settings in the Hosted Domains section are.