doyo 最新伪静态规则,doyo安全配置说明

曹え 5811 发布于:2019-09-17 23:08:21

把伪静态配置如下:

# 将 RewriteEngine 模式打开
RewriteEngine On

# 修改以下语句中的 / 改为您的DOYO系统目录地址,如果程序放在根目录中则无需修改
RewriteBase /

# Rewrite 下面是过滤静态文件夹禁止执行php文件以防安全请勿删除
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(uploads|images|template|js|css)/(.*).php$ errpage/404.html&%1

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-(w+)([0-9]+).html$ index.php?c=article&file=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-type-([0-9]+)-([0-9]+).html$ index.php?c=article&a=type&tid=$1&page=$2%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^product/(w+)([0-9]+).html$ index.php?c=product&file=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^product/type/([0-9]+)-([0-9]+).html$ index.php?c=product&a=type&tid=$1&page=$2%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^channel/(w+)/(w+)([0-9]+).html$ index.php?c=channel&molds=$1&file=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^channel/type/([0-9]+)-([0-9]+).html$ index.php?c=channel&a=type&tid=$1&page=$2%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^message-type-([0-9]+)-([0-9]+).html$ index.php?c=message&a=type&tid=$1&page=$2%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^special/([0-9]+)-([0-9]+).html$ index.php?c=special&sid=$1&page=$2%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(w+).html$ index.php?file=$1%1


index.php 改成下面的  放非法注入

<?php

 $url = $_SERVER['QUERY_STRING'];
 // 此入口只能包含下面关键词的可以访问,其他的一盖404
 if($url){
     if(!strstr($url, '=article') && !strstr($url, '=message')){
         echo '404';
         exit;
     }
}


require("config.php");

$doyoConfig['view']['config']['template_dir'] = APP_PATH.'/template/'.$doyoConfig['ext']['view_themes'];

require(DOYO_PATH."/sys.php");

spRun();


觉得有用请点个赞吧!
0 582