Tuesday, May 25th, 2010 | Author: admin
You don’t like to show your users a standard and simple http error pages. OK Then let’s see how to manage to send the users to a different page, and create your custom error pages.
- In httpd.conf file,
<Directory /var/www/>
AllowOverride None
Order allow,deny
allow from all
</Directory>to
<Directory /var/www/>
AllowOverride All
Order allow,deny
allow from all
</Directory> - Create .htaccess file, unless you do have one. It’s very simple to create a .htaccess file. Open some text editor and save the blank file name as .htaccess. Do not use any extension for the file name, just .htaccess. And don’t forget to put a dot before the file name.
Write the page url in it, where you will redirect the user to:
ErrorDocument 404 /404page.html
or you can just give a message:
ErrorDocument 404 “The page you are looking is no longer exists.” - Create a html file with the name you given in the .htaccess. So for our example we will create 404page.html in root directory.
- Call a page, that does not in your root directory.
! And don’t forget to restart your apache server, after you do some changes in apache’s configuration file httpd.conf.
You can extend this example for any other http errors. Use just one .htaccess file per directory.
Category: About
