How to create htaccess 404 redirect
The code you see below is designed to take your visitors to where-ever you want them to go if they accidentally land on a broken page on your server. This is a 404 error, and this is the code you need.
ErrorDocument 404 https://howtobg.com/
Where 'https://howtobg.com' is to be replaced with whatever you want to show them. In this case I have chosen to send traffic back to the root of the domain. More information on Stack Overflow
What is htaccess?
Htaccess is a configuration file that influences behaviour on Apache Web Servers. Simply put it talks directly to the engine running your site and tells it how to behave in certain industry standard scenarios - missing file, 404.
How to create an htaccess file
If you need to create a htaccess file on your server, you might find your hosts have already issued a .htaccess file. In order to see this on your server you may need to check the settings to show hidden files.
If you're starting from scratch all you need to do is open notepad or any text editor, enter the code and save it as .htaccess and upload it into the appropriate place on your server - normally within public_html .
It's very easy to write, but can wreak havoc if you get it wrong, so it's always best to keep a copy of the original .htaccess before you edit it