HOW TO create custom error pages?

Talk and info about common issues

Moderator: alexandrleonenko

Site Admin
Site Admin
Posts: 6037
Joined: Jan 7th, '09, 23:18

HOW TO create custom error pages?

Postby administrator » Feb 12th, '12, 11:03

Sometime you need to create custom error pages and redirect visitor to this page.
This functionality may be easily added to the script in a following way:

1. Add to your .htaccess file following commands:

Code: Select all

<IfModule mod_rewrite.c>
ErrorDocument 404 /errors/404.php
ErrorDocument 500 /errors/500.php
ErrorDocument 403 /errors/403.php

Instead of /errors/404.php you may define another way (depends on your real path, for example: /php-microcms/errors/404.php etc.)

2. Create such pages for your site, place them in the directory that was defined on previous step and add all needed HTML code and CSS for them.

Return to “ApPHP MicroCMS {HOW TO}”