开发者

how i can protect folder in my site by php htaccess

hello all i`m php developer and i try to use new method in my work i was divide all modules and put it in specific f开发者_StackOverflow社区older .my question how i can protect folder

ex:

www.test.com/cms/users/add.php

i want if some one try write in url

www.test.com/cms/users/

redirect too

www.test.com/cms/login.php

how i can please


I use this example in all my websites. On the line that is commented, you can see that I'm denying direct access to those folders (application, modules, system), just have to change for your own.

RewriteEngine On
RewriteBase /

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* index.php/$0 [PT]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜