I'm going mad over Apache .htaccess
I'm trying to setting as protected my subfolders using relative address, but it seems impossible.
The path of Apache folder is structured like this:
/var/www/apachedir
now I want to protect
/var/www/apachedir/subfolder/*
What I tryied is putting in /var/www/apachedir/
an .htaccess
file like this
<FilesMatch "subfolder\/.*">
Order Allow,Deny
Deny from all
</FilesMatch>
but it seems not woking good.
I don't want to use ModRewrite
and I want to make this .htaccess
reusable.
So, listen, if I put the site over an other server that has a direcory structure like /var/www/zzz
it has to protect files in /var/www/zzz/subfolder/*
.
Also the file .htaccess
has to stay in the root folder /var/www/apachedir
.
There's a way to do it?
Edit:
I don't want to use ModRewrite
but also I don't want to use Redirectmatch
.
I want to know if there's a way to set it up with FilesMatch
CodePudding user response:
I don't want to use
ModRewrite
.
You can use RedirectMatch
to block access to a known path:
Redirectmatch 403 ^/subfolder/