I have a .htaccess file that currently looks like:
order allow,deny deny from all Options All -Indexes IndexIgnore
1. You can use DirectorySlash Off
to tell Apache to not to add trailing slash at the end of directories.
2. Why use RewriteEngine On
if you do not actually use rewrite engine (based on the code you have provided)? RedirectMatch
has nothing to do with mod_rewrite
.
3. If you want to use mod_rewrite here, then try this rule -- it will return 404 code for /include
folder (with and without trailing slash) as well as ANY resource inside that file (e.g. /include/main.php
etc).
RewriteEngine On
RewriteRule ^include(/|/.+)?$ - [R=404,L]