I'm searchin on internet since yesterday and i couldn't find the answer. At least one that works for apache2.
I just want a set of rewritemod rules that will make apache redirect everything to a 404 but allows me to explicitly override it for some files/folders.
I've tried an inclusive rule but i couldn't get it working.
Thanks.
Just try this line in your .htaccess file:
RewriteRule ^(?!(allowedFile\.html|allowedDirectory/)) - [R=404,L,NC]
Above rule will throw 404 for everything except a file called allowedFile.html
and a folder called allowedDirectory
.
RewriteRule ^/protectedfolder/(.*) - [L] /* no substitution , serve as it is for this folder*/
RewriteRule ^$ - [R=404,L] /*reject everything */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With