How redirecting 404 error with .htaccess ?

How redirecting 404 error with .htaccess ?

404 error means “ page not found “.  Basically this occurs when you make a mistake spelling page name in a site while typing or reference by google search, of if the page is deleted or moved.

Add fallowing entry in .htaccess file for page redirection.

Make sure to create .htaccess file within the website source root directory and add fallowing entry

#vi .htaccess

ErrorDocument 404 /testing.html

Save and exit .

Modify apache configuration file to enable page redirection using symbolic link  Allow All

Add below lines in httpd.conf file; specify website source files location as indicated below.

#vi /etc/httpd/conf/httpd.conf

<Directory “/sites/”>

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Order allow,deny

allow from all


After modify httpd.conf file make sure to reload apache service in order changes take effect.

#service httpd reload

After reloading apache service,   visit the url with unknown keyword as indicated below.

Above URL should take you to testing.html  as specified in .htaccess file.

How redirecting 404 error with .htaccess, page redirection 404 error , how to redirect page using .htaccess file, An error page redirect using .htaccess ,