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
Try:
or whatever the homepage is
try:
It works fine for my site. I tried this code, it doesn't show 404 pages, but it shows the same URL but content of the homepage
You can do this like
this will be .htaccess file:
All the page not found pages will display 404.php file.
In 404.php file you can write:
So all page not found pages will go to 404.php page and it will redirect them to index.php
Works perfectly on my localhost.
Or save a reroute step and just put the following into your .htaccess file:
ErrorDocument 404 /index.php