Sometimes while browsing sites on the web, you must have noticed that some links show errors like:
– You don’t have permission to access the page.
– The requested URL /test.php is not found on this server.
Here it shows your server info and port. This is a server generated message. For each type of error, the server shows a static HTML page.
However, to make your site more attractive you can create you own customized page and show it in your web application instead of showing the system generated message. Also you can redirect the user to the index page.
This can be handled by using .htaccess file.
Create your own customized error pages for 404 or 403 or any other error type. You can create it with your own logo and content.
Create the .htaccess file in the root virtual directory and write the following code in the .htaccess file. ErrorDocument 404 404.html ErrorDocument 403 403.html
If you want to show your index page, if any of the 404 or 403 error occurs. Then write the following line in your htaccess file.