• 联盟
  • 文章
  • 当前位置:排行榜 > 资讯 > 经验学堂 > 列表经验学堂

    dede伪静态规则,IIS6用httpd.ini,IIS7_IIS8用web.config,apache

    编辑:996评测网 发布时间:2020-04-19 16:16 分类:经验学堂

    请确保你网站所在的主机或者服务器支持伪静态并且已经开启了伪静态功能!dede伪静态规则,IIS6用httpd.ini,IIS7_IIS8用web.config,apache用.htaccess

    本教程主要设置织梦伪静态页面包括有:

        列表页 /plus/list-2.html

        列表页分页 /plus/list-2-26-2.html

        内容页 /plus/view-112-1.html

        内容页分页 /plus/view-112-2.html

        TAG标签页 /tags/织梦/

        TAG标签分页 /tags/织梦/2/

        搜索页 /search/织梦.html

        搜索页分页 /search/织梦-2.html

     

    网站后台开启伪静态选项

    后台-系统参数-核心设置-是否使用伪静态:"是"

    后台-系统参数-核心设置-是否使用伪静态:"是"

     

    网站后台设置整站为动态

    这里可以借助我写的一个小插件来完成,一劳永逸

    插件介绍及下载地址 http://www.dede58.com/a/dedejq/8624.html

     

    1、列表页和内容页伪静态链接

    打开 includehelperschannelunit.helper.php 找到

     

    global $cfg_typedir_df;

    改成

    global $cfg_typedir_df, $cfg_rewrite;

    继续找到

    $reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;

    改成

    1
    2
    3
    4
    5
    6
    7
    8
    9
    if($cfg_rewrite == 'Y')
    {
        $reurl = $GLOBALS["cfg_phpurl"]."/list-".$typeid.'.html';
    }
    else
    {
        //动态
        $reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
    }

    2、手机版列表页分页不使用电脑版伪静态

    打开 includerc.listview.class.php 找到

    if($cfg_rewrite == 'Y')

    大概在1198行,把这一行改成

    if($cfg_rewrite == 'Y' && !defined('DEDEMOB'))

    3、TAG标签伪静态链接

    打开 include aglib ag.lib.php 找到

    $row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";

    改成

    $row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";

    4、TAG标签分页伪静态链接

    打开 includerc.taglist.class.php 找到

    $this->PageNo = $GLOBALS['PageNo'];

    在它的下面加入

    if($this->PageNo == 0)

    {

        $this->PageNo = 1;

    }

    继续找到

    $prepage="";

    在它的上面加入

    global $cfg_rewrite;

    继续找到

    $purl .= "?/".urlencode($this->Tag);

    改成

    1
    2
    3
    4
    5
    6
    7
    8
    if($cfg_rewrite == 'Y')
    {
        $purl = "/tags/".urlencode($this->Tag);
    }
    else
    {
        $purl .= "?/".urlencode($this->Tag);
    }

    4、搜索页伪静态链接

    打开 plussearch.php 找到

    $t1 = ExecTime();

    在它的下面加入

    $keyword = preg_replace("/-(d+)/i",'',$keyword);

    $oldkeyword = preg_replace("/-(d+)/i",'',$oldkeyword);

    打开 includerc.searchview.class.php 找到

    global $oldkeyword;

    改成

    global $oldkeyword, $cfg_rewrite;

    继续找到

    $purl .= "?".$geturl;

    改成

    if($cfg_rewrite != 'Y' && !defined('DEDEMOB'))

    {

        $purl .= "?".$geturl;

    }

    else

    {

        $purl = '/search/'.urlencode($oldkeyword);

    }

    继续找到

    return $plist;

    在它的上面加入

    if($cfg_rewrite == 'Y' && !defined('DEDEMOB'))

    {

        $plist = preg_replace("/PageNo=(d+)/i",'-.html',$plist);

    }

     

    最后还需要在你模板里搜索框代码改成静态的js提交搜索,参考下面代码,注意标红的地方

    <script type="text/javascript">

    function search()

    {

        var q = document.getElementById("q").value;

        window.location.href = "http://www.dede58.com/search/"+q+".html";

    }

    function enterIn(obj,evt)

    {

        var evt = evt ? evt : (window.event ? window.event : null);

        if (evt.keyCode == 13)

        {

            var q = obj.value;

            window.location.href = "http://www.dede58.com/search/"+q+".html";

        }

    }

    </script>

    <form action="" method="post" onsubmit="return false">

        <div>

            <h4>搜索</h4>

            <input name="q" id="q" onkeydown="enterIn(this,event);" type="text" />

            <button type="submit" onclick="search()">搜索</button>

        </div>

    </form>

     

    伪静态规则文件打包下载

    云盘下载 http://pan.baidu.com/s/1bpNIEN9       密码: vf18

     

    iis6伪静态规则 httpd.ini
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    #列表页和列表分页
    RewriteRule ^(.*)/plus/list-([0-9]+).html $1/plus/list.php?tid=$2
    RewriteRule ^(.*)/plus/list-([0-9]+)-([0-9]+)-([0-9]+).html $1/plus/list.php?tid=$2&TotalResult=$3&PageNo=$4
    #内容页和内容分页
    RewriteRule ^(.*)/plus/view-([0-9]+)-([0-9]+).html $1/plus/view.php?arcID=$2&pageno=$3
    #TAG标签伪静态规则
    RewriteRule ^(.*)/tags.html $1/tags.php [I]
    RewriteRule ^(.*)/tags/(.*)(?:(?.*))* $1/tags.php?/$2 [I]
    RewriteRule ^(.*)/tags/(.*)/(?:(?.*))* $1/tags.php?/$2/ [I]
    RewriteRule ^(.*)/tags/(.*)/([0-9])(?:(?.*))* $1/tags.php?/$2/$3 [I]
    RewriteRule ^(.*)/tags/(.*)/([0-9])/(?:(?.*))* $1/tags.php?/$2/$3/ [I]
    #搜索页
    RewriteRule ^(.*)/search/(.*)-([0-9]+).html  $1/plus/search.php?q=$2&PageNo=$3&pagesize=2&searchtype=title
    RewriteRule ^(.*)/search/(.*).html  $1/plus/search.php?q=$2&pagesize=2&searchtype=title

     

    iis7、8伪静态规则 web.config

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="首页">
                        <match url="^index.html$" ignoreCase="false" />
                        <action type="Rewrite" url="index.php" appendQueryString="false" />
                    </rule>
                    <rule name="列表">
                        <match url="^plus/list-([0-9]+).html$" ignoreCase="false" />
                        <action type="Rewrite" url="/plus/list.php?tid={R:1}" appendQueryString="false" />
                    </rule>
                    <rule name="列表分页">
                        <match url="^plus/list-([0-9]+)-([0-9]+)-([0-9]+).html$" ignoreCase="false" />
                        <action type="Rewrite" url="/plus/list.php?tid={R:1}&amp;totalresult={R:2}&amp;PageNo={R:3}" appendQueryString="false" />
                    </rule>
                    <rule name="文章分页">
                        <match url="^plus/view-([0-9]+)-([0-9]+).html$" ignoreCase="false" />
                        <action type="Rewrite" url="/plus/view.php?aid={R:1}&amp;pageno={R:2}" appendQueryString="false" />
                    </rule>
                                         <rule name="tag首页">
                                                   <match url="^tags.html$" ignoreCase="false" />
                                                   <action type="Rewrite" url="tags.php" appendQueryString="false" />
                                         </rule>
                                         <rule name="tag列表">
                                                   <match url="^tags/(.*)(?:(?.*))*$" ignoreCase="false" />
                                                   <action type="Rewrite" url="/tags.php?/{R:1}" appendQueryString="false" />
                                         </rule>
                                         <rule name="tag列表最后有左斜杠">
                                                   <match url="^tags/(.*)/(?:(?.*))*$" ignoreCase="false" />
                                                   <action type="Rewrite" url="/tags.php?/{R:1}/" appendQueryString="false" />
                                         </rule>
                                         <rule name="tag列表分页">
                                                   <match url="^tags/(.*)/([0-9])(?:(?.*))*$" ignoreCase="false" />
                                                   <action type="Rewrite" url="/tags.php?/{R:1}/{R:2}" appendQueryString="false" />
                                         </rule>
                                         <rule name="tag列表分页最后有左斜杠">
                                                   <match url="^tags/(.*)/([0-9])/(?:(?.*))*$" ignoreCase="false" />
                                                   <action type="Rewrite" url="/tags.php?/{R:1}/{R:2}/" appendQueryString="false" />
                                         </rule>
                                         <rule name="搜索页分页">
                        <match url="^search/(.*)-([0-9]+).html$" ignoreCase="false" />
                        <action type="Rewrite" url="/plus/search.php?q={R:1}&amp;PageNo={R:2}&amp;pagesize=2&amp;searchtype=title" appendQueryString="false" />
                    </rule>
                                         <rule name="搜索页">
                        <match url="^search/(.*).html$" ignoreCase="false" />
                        <action type="Rewrite" url="/plus/search.php?q={R:1}&amp;pagesize=2&amp;searchtype=title" appendQueryString="false" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>

     

    apache伪静态规则 .htaccess

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    #列表页和列表分页
    RewriteRule ^plus/list-([0-9]+).html$ plus/list.php?tid=$1
    RewriteRule ^plus/list-([0-9]+)-([0-9]+)-([0-9]+).html$ plus/list.php?tid=$1&TotalResult=$2&PageNo=$3     
    #内容页和内容分页
    RewriteRule ^plus/view-([0-9]+)-([0-9]+).html$ plus/view.php?arcID=$1&pageno=$2
    #TAG标签
    RewriteRule ^tags.html$ tags.php
    RewriteRule ^tags/(.*)(?:(?.*))* tags.php?/$1
    RewriteRule ^tags/(.*)/(?:(?.*))*  tags.php?/$1/
    RewriteRule ^tags/(.*)/([0-9])(?:(?.*))* tags.php?/$1/$2
    RewriteRule ^tags/(.*)/([0-9])/(?:(?.*))*  tags.php?/$1/$2/
    #搜索页
    RewriteRule ^search/(.*)-([0-9]+).html$  plus/search.php?q=$1&PageNo=$2&pagesize=2&searchtype=title
    RewriteRule ^search/(.*).html$  plus/search.php?q=$1&pagesize=2&searchtype=title
    nginx伪静态规则
    rewrite ^/plus/list-([0-9]+).html$ /plus/list.php?tid=$1;
    rewrite ^/plus/list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3;
    rewrite ^/plus/view-([0-9]+)-1.html$ /plus/view.php?arcID=$1;
    rewrite ^/plus/view-([0-9]+)-([0-9]+).html$ /plus/view.php?aid=$1&pageno=$2;
    rewrite ^/tags.html$ /tags.php;
    rewrite ^/tags/(.*)(?:(?.*))* /tags.php?/$1;
    rewrite ^/tags/(.*)/(?:(?.*))*  /tags.php?/$1/;
    rewrite ^/tags/(.*)/([0-9])(?:(?.*))* /tags.php?/$1/$2;
    rewrite ^/tags/(.*)/([0-9])/(?:(?.*))*  /tags.php?/$1/$2/;
    rewrite ^/search/(.*)-([0-9]+).html$  /plus/search.php?q=$1&PageNo=$2&pagesize=2&searchtype=title;
    rewrite ^/search/(.*).html$  /plus/search.php?q=$1&pagesize=2&searchtype=title;
     


    (责任编辑:996top广告联盟评测)
    上一篇:模板无法在这个位置找到: head.htm及footer.htm 下一篇:.htaccess转为web.config怎么自动转换?
    下级栏目
    最新加入
  • 12020-07-20CPS日结广告联盟
  • 22020-07-15发发广告联盟
  • 32020-07-05团成移动联盟
  • 42020-06-22蜜趣CPS联盟
  • 52020-05-05趣米移动广告
  • 62020-04-28斯巴达联盟
  • 72020-04-28萌新移动联盟
  • 82020-04-22八通广告联盟
  • 92020-04-19998广告联盟
  • 102020-04-15誉见广告平台
  • 热评联盟
  • 1点评[93]铁憨憨广告联盟
  • 2点评[32]非凡广告联盟
  • 3点评[25]誉见广告平台
  • 4点评[22]辉耀移动联盟
  • 5点评[19]巨梦广告联盟
  • 6点评[16]望云广告联盟
  • 7点评[13]快唯广告联盟
  • 8点评[12]晨阳广告传媒
  • 9点评[10]盖亚联盟CPA
  • 10点评[10]亿云联盟
  • 服务排行
    人气排行
  • 1浏览[426]盖亚联盟CPA
  • 2浏览[271]趣米移动广告
  • 3浏览[266]青瓜传媒APP推广
  • 4浏览[218]小明精准联盟
  • 5浏览[215]百度联盟
  • 6浏览[190]CPA唯尚广告联盟
  • 7浏览[152]非凡广告联盟
  • 8浏览[125]易盟广告
  • 9浏览[120]联合云享广告平台
  • 10浏览[116]超越广告联盟
  • 关于996| 版权声明| 联系方式| 广告服务

    Copyright © 版权所有:996评测网 广告联系QQ:2220095515 (请注明:投广告)
    (评论内容只代表网友观点,与996评测网立场无关)