Redirect 404 page through .htaccess
Hi, Today i am going to explain how to redirect 404 page using .htaccess. Here is the code, you have to put this code in your .htaccess file which will be under root directory.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /404.php
</IfModule>
Its very easy to use. If your .htaccess is not working you have to enable it from apache. Please follow these steps,
1. Open your httpd.conf file
2. Make sure LoadModule rewrite_module modules/mod_rewrite.so line should be enable (by removing # before this line.)
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /404.php
</IfModule>
Its very easy to use. If your .htaccess is not working you have to enable it from apache. Please follow these steps,
1. Open your httpd.conf file
2. Make sure LoadModule rewrite_module modules/mod_rewrite.so line should be enable (by removing # before this line.)
Comments
Post a Comment