用QQ帐号登录应用中心QQ登录
Discuz! 应用中心

标签伪静态规则

一、空标签404优化:
if(empty($tag['tagname'])) {
        header("HTTP/1.1 404 Not Found");
        showmessage('thread_nonexistence');
}

// $tag = DB::fetch_first("SELECT * FROM ".DB::table('common_tag')." WHERE tagid = '$id'");

//        $metakeywords = !empty($tag['keywords']) ? dhtmlspecialchars($tag['keywords']) : ($tagname ? $tagname : $taglang);
//        $metadescription = !empty($tag['description']) ? dhtmlspecialchars($tag['description']) : ($tagname ? $tagname : $taglang);

二、伪静态规则,放在其它DZ规则的上面,如:thread规则这一行上面


# IIS/APACHE Web Server 1                                                          
RewriteRule ^(.*)/tag(_([0-9]+))?(/|\.html)?$ $1/plugin\.php\?id=onexin_tags&page=$3&%1
RewriteRule ^(.*)/tag-(\d+)(-(\d+))?(/|\.html)?$ $1/plugin\.php\?id=onexin_tags&tagid=$2&page=$4&%1
RewriteRule ^(.*)/tag/([^\/\.]+)(/(\d+))?(/|\.html)?$ $1/plugin\.php\?id=onexin_tags&tagname=$2&page=$4&%1

# IIS/APACHE Web Server 2                                                           
RewriteRule ^tag(_([0-9]+))?(/|\.html)?$ plugin.php?id=onexin_tags&page=$2&%1      
RewriteRule ^tag-(\d+)(-(\d+))?(/|\.html)?$ plugin.php?id=onexin_tags&tagid=$1&page=$3&%1         
RewriteRule ^tag/([^\/\.]+)(/(\d+))?(/|\.html)?$ plugin.php?id=onexin_tags&tagname=$1&page=$3&%1

# Nginx Web Server             
rewrite ^([^\.]*)/tag(_([0-9]+))?(/|\.html)?$ $1/plugin.php?id=onexin_tags&page=$3 last;
rewrite ^([^\.]*)/tag-(\d+)(-(\d+))?(/|\.html)?$ $1/plugin.php?id=onexin_tags&tagid=$2&page=$4 last;
rewrite ^([^\.]*)/tag/([^\/\.]+)(/(\d+))?(/|\.html)?$ $1/plugin.php?id=onexin_tags&tagname=$2&page=$4 last;

# IIS 7.x及以上 Web Server(独立主机用户)
<rule name="onexin_tag_1">
<match url="^(.*/)*tag(_([0-9]+))?(/|\.html)?$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=onexin_tags&amp;page={R:3}" />
</rule>
<rule name="onexin_tag_2">
<match url="^(.*/)*tag-(\d+)(-(\d+))?(/|\.html)?$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=onexin_tags&amp;tagid={R:2}&amp;page={R:4}" />
</rule>
<rule name="onexin_tag_3">
<match url="^(.*/)*tag/([^\/\.]+)(/(\d+))?(/|\.html)?$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=onexin_tags&amp;tagname={R:2}&amp;page={R:4}" />
</rule>

=================网址说明=============================
旧规则
http://demo.onexin.com/tag.html
http://demo.onexin.com/tag-110.html

新规则(推荐目录化写法)
http://demo.onexin.com/tag/
http://demo.onexin.com/tag/影响力/

Discuz!交流社区 | Discuz!程序下载 | Discuz!使用教程 | 我是Discuz!开发者 | 我是Discuz!分销商

Copyright ©2024Dismall.comAll Rights Reserved. 皖ICP备16010102号-4 增值电信业务经营许可证:皖B2-20200047

违法网站请勿向我司工作人员及应用开发者发起任何形式的服务请求,严禁使用Discuz!应用中心提供的应用从事任何非法活动

  应用中心操作、授权恢复等使用问题,联系应用中心客服|Discuz! 安装、升级、问题排查、定制,联系有偿服务客服

返回顶部