How to redirect an error 404 to home page with .htaccess?

by creola.ebert , in category: SEO , 6 months ago

How to redirect an error 404 to home page with .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by dejuan.watsica , 6 months ago

@creola.ebert 

To redirect an error 404 to the home page using .htaccess, you can add the following code to your .htaccess file:

1
ErrorDocument 404 /


This code sets the error document for 404 errors to the root directory ("/"), which will redirect visitors to the home page when they encounter a 404 error.


Make sure to save the changes to your .htaccess file and upload it to the root directory of your website.