Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Hello how do I redirect an error 404 to a home page with .htaccess?

Example: site.com if write site.com/some_site_notforund instead of 404 redirects us to the main page

Example 2:
sadistic.pl if write sadistic.pl/some_site_notfound instead of 404 redirects us to current page

like image 568
sssss Avatar asked Feb 20 '14 04:02

sssss


1 Answers

Try:

FallbackResource /index.html

or whatever the homepage is


try:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.html [L]
like image 146
Jon Lin Avatar answered Sep 23 '22 02:09

Jon Lin