I want to display a 404 (Not found) message, when the user tries to access unauthorized directory. I do not want to use Forbidden pages. I have tried with below code, but it does not work.
RedirectMatch 404 ^/htaccess/.*$
Any idea on what might be going wrong?
try adding the following to your htaccess file
Edit
If you have a lot of folders then use a RewriteCond as below as it is easier to read than multiple folders in a single RewriteRule or multiple RewriteRules, which duplicate the 404 piece