Error Pages 2

Problem:

How to customize your html or php error pages.

Solution:

To customize your html or php pages, edit your .htaccess file and add a edit the following entry to fit your site:

ErrorDocument error-number /Your-Error-file.html

For example if I had the file notfound.html in the root directory of my site and I wanted to use it for a 404 error I would use:

  ErrorDocument 404 /notfound.html

The other way is a work-around. But works really well. It just redirects the old error page to the new error page.

Make an error page such as Errorpage1.shtml. Then fill out this .htaccess redirect entry.

  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_URI} ^$
  RewriteCond %{HTTP_HOST} ^domain.com/400.shtml$
  RewriteRule ^$ http://domain.com/errorpage1.shtml [L,R=301]
  • 35 Users Found This Useful
Was this answer helpful?

Related Articles

Configuring the PHP Environment With php.ini

Problem: How do I change the PHP environment for my site with php.ini? Solution:   To...

PHP with FastCGI

Problem: What is FastCGI for PHP? Solution: FastCGI for PHP makes all your PHP applications...

Upload_Max_Filesize

Problem: How do I change my upload_max_filesize? Solution: Summary Locate the php.ini...

Cron Jobs with PHP Files

How do I run a php file using Cron jobs?   From the cPanel, click the Cron Jobs icon and enter...

Basic Site Security Checklist

Remove malicious files and/or files you are not familiar with. While many PHP applications...