This works for both pages and directories, so your users will always have content to browse and not a 404 error. Finally, you can take advantage of this and create a custom 404 error page that can be fun or entertaining, perhaps displaying a funny picture or quote. This way, your visitors won't mind getting to the page.
Here are some tips to help you deal with broken links and 404 pages. For them to work, you will need to put the code in your .htaccess file. This is how you can edit .htaccess with FTP (FileZilla)
Open FileZilla
Log in to your server
Open public_html to list your b2b email list site's files.
Select .htaccess
right click it and select View / Edit or download to your computer.
If you cannot find the .htaccess file on your server, most likely it is not there or is simply hidden. First, make sure the "Show hidden files (dotfiles)" option is selected if you are logged in to cPanel and using the file manager, or if the "Force hidden files" option is selected in the FileZilla top menu. If you still cannot find the file, you should create a new one in the public_html folder by right-clicking and creating a new file named ".htaccess".