国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > 織夢DEDE > 正文

織夢全站偽靜態設置+全套偽靜態規則精華教程

2024-07-12 09:00:23
字體:
來源:轉載
供稿:網友

請確保你網站所在的主機或者服務器支持偽靜態并且已經開啟了偽靜態功能!

本教程主要設置織夢偽靜態頁面包括有:

    列表頁 /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.CUOxin.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",'-/1.html',$plist);

}

 

最后還需要在你模板里搜索框代碼改成靜態的js提交搜索,參考下面代碼,注意標紅的地方

<script type="text/javascript">

function search()

{

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

    window.location.href = "http://www.CUOxin.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.CUOxin.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;

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 玉门市| 怀集县| 廉江市| 精河县| 奉贤区| 迁西县| 北辰区| 敖汉旗| 万州区| 克山县| 庄浪县| 尖扎县| 滦平县| 吉林市| 嘉黎县| 宁陵县| 鹤山市| 罗田县| 永仁县| 蕉岭县| 永嘉县| 凤山市| 中牟县| 磐石市| 镇康县| 桦南县| 海淀区| 昭平县| 五指山市| 彭泽县| 尼玛县| 吴旗县| 丹阳市| 平舆县| 龙里县| 永兴县| 平原县| 龙岩市| 建宁县| 宣化县| 慈利县|