最新消息:伪静态技术大全博客开通啦!再也不为伪静态东奔西走!更多问题可以反映给博主:野狼,QQ1615241386 QQ交流群:112696646

5种discuz伪静态规则打包下载,亲测可用

伪静态规则实例 野狼 160浏览 0评论

【请根据以下规则选好文件】
.htaccess  多见于linux系统,Apache服务器。
discuz.conf 多见于linux系统,Nginx服务器
httpd.conf  一般是西部数码管理助手上绿色版本的伪静态组件
httpd.ini 一般见于win2003系统上安装的IIS6.0搭配的伪静态组件
web.config  一般见与IIS7以上版本的IIS上伪静态组件
伪静态文件应该放到哪里呢?
.htaccess 、 httpd.ini 、web.config 一般是放到网站根目录。
discuz.conf、httpd.conf需要放到伪静态组件引入的位置,这两个配置起来技术含量就有点高了,后边我们会记录野狼为客户做的伪静态过程。以前做的都还没有保存,有些遗憾。网上类似的资料比较少。
更多使用说明见 伪静态技术博客:http://www.weijingtai.org/
第一种:.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{http_host} ^390seo.com [NC]
RewriteRule ^(.*)$ http://www.390seo.com/$1 [L,R=301]
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?Rurl=$2
RewriteRule ^(.*)forum-(w+)-([0-9]+).html$ $1forum.php?mod=forumdisplay&fid=$2&page=$3
RewriteRule ^(.*)topic-(.+).html$ $1portal.php?mod=topic&topic=$2
RewriteRule ^(.*)article-([0-9]+)-([0-9]+).html$ $1portal.php?mod=view&aid=$2&page=$3
RewriteRule ^(.*)thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$4
RewriteRule ^(.*)group-([0-9]+)-([0-9]+).html$ $1forum.php?mod=group&fid=$2&page=$3
RewriteRule ^(.*)space-(username|uid)-(.+).html$ $1home.php?mod=space&$2=$3
RewriteRule ^(.*)blog-([0-9]+)-([0-9]+).html$ $1home.php?mod=space&uid=$2&do=blog&id=$3
RewriteRule ^(.*)archiver/(fid|tid)-([0-9]+).html$ $1archiver/index.php?action=$2&value=$3
</IfModule>

第二种:discuz.conf
location / {
if ($host = 'weijigntai.org' ) {
rewrite ^/(.+)$ http://www.weijigntai.org/$1 permanent;
}
rewrite ^([^.]*)/topic-(.+).html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^.]*)/article-([0-9]+)-([0-9]+).html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^.]*)/forum-(w+)-([0-9]+).html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^.]*)/group-([0-9]+)-([0-9]+).html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^.]*)/space-(username|uid)-(.+).html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^.]*)/([a-z]+)-(.+).html$ $1/$2.php?rewrite=$3 last;
if (!-e $request_filename) {
return 404;
}
}

第三种:httpd.conf
RegistrationName= wlqcwin
RegistrationCode= 2EAD-35GH-66NN-ZYBA
[ISAPI_Rewrite]
#伪静态技术博客www.weijingtai.org整理提供,转载请注明
CacheClockRate 3600
RepeatLimit 32
#apache和iis通用(apache需去除[NU]参数)
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?Rurl=$2 [I]
RewriteRule ^(.*)forum-(w+)-([0-9]+).html$ $1forum.php?mod=forumdisplay&fid=$2&page=$3 [I]
RewriteRule ^(.*)topic-(.+).html$ $1portal.php?mod=topic&topic=$2 [I]
RewriteRule ^(.*)article-([0-9]+)-([0-9]+).html$ $1portal.php?mod=view&aid=$2&page=$3 [I]
RewriteRule ^(.*)thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$4 [I]
RewriteRule ^(.*)group-([0-9]+)-([0-9]+).html$ $1forum.php?mod=group&fid=$2&page=$3 [I]
RewriteRule ^(.*)space-(username|uid)-(.+).html$ $1home.php?mod=space&$2=$3 [I]
RewriteRule ^(.*)blog-([0-9]+)-([0-9]+).html$ $1home.php?mod=space&uid=$2&do=blog&id=$3 [I]
RewriteRule ^(.*)archiver/(fid|tid)-([0-9]+).html$ $1archiver/index.php?action=$2&value=$3 [I]
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_-]+).html$ plugin.php?id=$1:$2 [I]

第四种:httpd.ini
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
#伪静态技术博客www.weijingtai.org提供
RewriteRule ^(.*)/topic-(.+).html(?(.*))*$ $1/portal.php?mod=topic&topic=$2&$4
RewriteRule ^(.*)/article-([0-9]+)-([0-9]+).html(?(.*))*$ $1/portal.php?mod=view&aid=$2&page=$3&$5
RewriteRule ^(.*)/forum-(w+)-([0-9]+).html(?(.*))*$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&$5
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html(?(.*))*$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
RewriteRule ^(.*)/group-([0-9]+)-([0-9]+).html(?(.*))*$ $1/forum.php?mod=group&fid=$2&page=$3&$5
RewriteRule ^(.*)/space-(username|uid)-(.+).html(?(.*))*$ $1/home.php?mod=space&$2=$3&$5
RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+).html(?(.*))*$ $1/home.php?mod=space&uid=$2&do=blog&id=$3&$5
RewriteRule ^(.*)/(fid|tid)-([0-9]+).html(?(.*))*$ $1/index.php?action=$2&value=$3&$5
RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_-]+).html(?(.*))*$ $1/plugin.php?id=$2:$3&$5

第五种:web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="r1">
<match url="^(.*/)*topic-(.+).html?*(.*)$" />
<action type="Rewrite" url="{R:1}/portal.php?mod=topic&amp;topic={R:2}&amp;{R:3}" />
</rule>
<rule name="r2">
<match url="^(.*/)*article-([0-9]+)-([0-9]+).html?*(.*)$" />
<action type="Rewrite" url="{R:1}/portal.php?mod=view&amp;aid={R:2}&amp;page={R:3}&amp;{R:4}" />
</rule>
<rule name="r3">
<match url="^(.*/)*forum-(w+)-([0-9]+).html?*(.*)$" />
<action type="Rewrite" url="{R:1}/forum.php?mod=forumdisplay&amp;fid={R:2}&amp;page={R:3}&amp;{R:4}" />
</rule>
<rule name="r4">
<match url="^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+).html?*(.*)$" />
<action type="Rewrite" url="{R:1}/forum.php?mod=viewthread&amp;tid={R:2}&amp;extra=page%3D{R:4}&amp;page={R:3}&amp;{R:5}" />
</rule>
<rule name="r5">
<match url="^(.*/)*group-([0-9]+)-([0-9]+).html?*(.*)$" />
<action type="Rewrite" url="{R:1}/forum.php?mod=group&amp;fid={R:2}&amp;page={R:3}&amp;{R:4}" />
</rule>
<rule name="r6">
<match url="^(.*/)*space-(username|uid)-(.+).html?*(.*)$" />
<action type="Rewrite" url="{R:1}/home.php?mod=space&amp;{R:2}={R:3}&amp;{R:4}" />
</rule>
<rule name="r7">
<match url="^(.*/)*blog-([0-9]+)-([0-9]+).html?*(.*)$" />
<action type="Rewrite" url="{R:1}/home.php?mod=space&amp;uid={R:2}&amp;do=blog&amp;id={R:3}&amp;{R:4}" />
</rule>
<rule name="r8">
<match url="^(.*/)*(fid|tid)-([0-9]+).html?*(.*)$" />
<action type="Rewrite" url="{R:1}/index.php?action={R:2}&amp;value={R:3}&amp;{R:4}" />
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<clear />
<add value="index.asp" />
<add value="dufault.html" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
<add value="index.php" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

当然,有些网站的环境特殊,还有一些程序修改过或者是版本问题,会有部分代码有问题。如果碰到问题,欢迎联系野狼,或者给我们留言。我会第一时间帮你解决!
下载网址:discuz伪静态规则打包

发表评论
请遵守网络文明公约,理性发言
访客头像

还没有人来评论,快来抢个沙发吧!