How to rewrite 404 to home page using htaccess?

There are a couple of ways to do this.

  1. If you’re using a custom theme or a child theme, add (or edit) a theme file called 404.php. The contents of that file should be:

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();
?>

  1. You can add this code as a plugin, or put it in your (custom or child) theme’s functions.php file:

<?php
function redirect_404s() {
if(is_404()) {
wp_redirect(home_url(), '301');
}
}
add_action('wp_enqueue_scripts', 'redirect_404s');
?>