Custom Error Pages without Cpanel

If you're looking to create custom error pages the old fashioned way (editing the .htaccess file yourself), look no further. To do so you must first edit an .htaccess file in your public_html directory so that it has the following lines in it:

  • ErrorDocument 404 /myerrors/404.html
  • ErrorDocument 403 /myerrors/403.html
  • ErrorDocument 500 /myerrors/500.html

To explain what each part is we'll cut it up:

ErrorDocument - the command that tells apache that this is the error document to use for this directory and all directories under it unless a directory under it specifies otherwise.

404 (403 and 500) - The error code that states which error this document is to be called for.

/myerrors/404.html (403.html and 500.html) - the document that is to be used if this error should arise. In this case the error documents are located within the /public_html/myerrors/ directory. Please note that you need the / at the beginning so that apache (the web server) knows to start at /public_html/ .With the above used document location, the url remains the same, but the error page is shown. If you wish to have it so the url changes to that of the error page then simply turn it into a url. The example below shows how to do this for the 404 (file not found) error:

ErrorDocument 404 http://www.yourdomain.com/myerrors/404.html

Should you notice that after doing this, your error page doesn't come up, check spelling, capitalization and the path or url of the error document to make sure it's correct. If it is, then try adding more content to the error page. Some browsers are set so that if there isn't enough content in the error page, they use their own default error page.

Was this answer helpful?

 Print this Article

Also Read

Contacting us for Support

To receive support - Please log in to your client area at https://www/mysupportplus.com. Your...

Guide to .htaccess

http://javascriptkit.com/howto/htaccess.shtml

Blocking IP Addresses

If you need to block an IP address from accessing a directory on your site, place the following...

Can ServPlus.net transfer my websites over from another provider?

If you account is hosted on a cPanel server we will transfer your account to our server. We will...

If you cannot access your site

If you still can't access your site and suspect that there is a server outage [we will know about...

Powered by WHMCompleteSolution