开发者

how i can protect folder in my site by php htaccess

开发者 https://www.devze.com 2023-01-31 23:07 出处:网络
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

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

精彩评论

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