首页 > 建站‧营销

dedecms禁止某些目录运行php脚本


apache环境,使用 .htaccess 文件来设置,复制以下代码添加进去:

RewriteCond%!^$
RewriteRulea/(.*).(php)$–[F]
RewriteRuledata/(.*).(php)$–[F]
RewriteRuleimages/(.*).(php)$–[F]
RewriteRulecss/(.*).(php)$–[F]
RewriteRulejs/(.*).(php)$–[F]
RewriteRulestyle/(.*).(php)$–[F]
RewriteRuleskin/(.*).(php)$–[F]
RewriteRuletemplets/(.*).(php|htm)$–[F]
RewriteRuleuploads/(.*).(php)$–[F]

windows主机的用户一般都是iis7、iis8环境,将以下代码复制到根目录的web.config 文件:

<rule name="Blocka"stopProcessing="true">
<match url="^a/(.*).php$"/>
<conditions logicalGrouping="MatchAny">
<add input="{USER_AGENT}" pattern="a"/>
<add input="{REMOTE_ADDR}" pattern=""/>
</conditions>
<action type="AbortRequest"/>
</rule>

<rule name="Blockdata" stopProcessing="true">
<match url="^data/(.*).php$"/>
<conditions logicalGrouping="MatchAny">
<add input="{USER_AGENT}" pattern="data"/>
<add input="{REMOTE_ADDR}" pattern=""/>
</conditions>
<action type="AbortRequest"/>
</rule>

#安全设置复制上述代码,修改目录即可!

本文链接:https://zhanque.net/cms/4694.html