Pron
Pron

Reputation: 21

htaccess deny main folder allow subfolder

How do i create a htaccess file that denies access to a main folder, but allows access to a subfolder?

example: http://www.mysite.net/folder1 (deny acces) http://www.mysite.net/folder1/folder2 (allow acces)

Upvotes: 2

Views: 240

Answers (1)

BillyBigPotatoes
BillyBigPotatoes

Reputation: 1338

If you have access to mod_rewrite then you can add some conditions into your config -

You could capture requests and rewrite them to a different place using

RewriteCond {REQUESTED_FILE} !^/?(.*)/+$
RewriteRule .....

Or to just block them

RewriteRule  !^/?(.*)/+$ - [F]

Upvotes: 0

Related Questions