当前位置:首页 >> 技术方案 >> 详情

Discuz X1.5 伪静态规则

发布时间:2010-10-18   浏览次数:86次   作者:未知    标签:郑州seo 郑州seo推广 郑州网站推广

1. Apache Web Server(独立主机用户)

 
01 <IfModule mod_rewrite.c>
02         RewriteEngine On
03         RewriteCond %{QUERY_STRING} ^(.*)$
04         RewriteRule ^(.*)/topic-(.+).html$ $1/portal.php?mod=topic&topic=$2&%1
05         RewriteCond %{QUERY_STRING} ^(.*)$
06         RewriteRule ^(.*)/article-([0-9]+)-([0-9]+).html$ $1/portal.php?mod=view&aid=$2&page=$3&%1
07         RewriteCond %{QUERY_STRING} ^(.*)$
08         RewriteRule ^(.*)/forum-(w+)-([0-9]+).html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1
09         RewriteCond %{QUERY_STRING} ^(.*)$
10         RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1
11         RewriteCond %{QUERY_STRING} ^(.*)$
12         RewriteRule ^(.*)/group-([0-9]+)-([0-9]+).html$ $1/forum.php?mod=group&fid=$2&page=$3&%1
13         RewriteCond %{QUERY_STRING} ^(.*)$
14         RewriteRule ^(.*)/space-(username|uid)-(.+).html$ $1/home.php?mod=space&$2=$3&%1
15         RewriteCond %{QUERY_STRING} ^(.*)$
16         RewriteRule ^(.*)/([a-z]+)-(.+).html$ $1/$2.php?rewrite=$3&%1
17 </IfModule>

2. Apache Web Server(虚拟主机用户)

 
01 # 将 RewriteEngine 模式打开
02 RewriteEngine On
03   
04 # 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
05 RewriteBase /discuz
06   
07 # Rewrite 系统规则请勿修改
08 RewriteCond %{QUERY_STRING} ^(.*)$
09 RewriteRule ^topic-(.+).html$ portal.php?mod=topic&topic=$1&%1
10 RewriteCond %{QUERY_STRING} ^(.*)$
11 RewriteRule ^article-([0-9]+)-([0-9]+).html$ portal.php?mod=view&aid=$1&page=$2&%1
12 RewriteCond %{QUERY_STRING} ^(.*)$
13 RewriteRule ^forum-(w+)-([0-9]+).html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
14 RewriteCond %{QUERY_STRING} ^(.*)$
15 RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+).html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
16 RewriteCond %{QUERY_STRING} ^(.*)$
17 RewriteRule ^group-([0-9]+)-([0-9]+).html$ forum.php?mod=group&fid=$1&page=$2&%1
18 RewriteCond %{QUERY_STRING} ^(.*)$
19 RewriteRule ^space-(username|uid)-(.+).html$ home.php?mod=space&$1=$2&%1
20 RewriteCond %{QUERY_STRING} ^(.*)$
21 RewriteRule ^([a-z]+)-(.+).html$ $1.php?rewrite=$2&%1

3. IIS Web Server(独立主机用户)

 
01 [ISAPI_Rewrite]
02   
03 # 3600 = 1 hour
04 CacheClockRate 3600
05   
06 RepeatLimit 32
07   
08 # Protect httpd.ini and httpd.parse.errors files
09 # from accessing through HTTP
10 RewriteRule ^(.*)/topic-(.+).html?*(.*)$ $1/portal.php?mod=topic&topic=$2&$3
11 RewriteRule ^(.*)/article-([0-9]+)-([0-9]+).html?*(.*)$ $1/portal.php?mod=view&aid=$2&page=$3&$4
12 RewriteRule ^(.*)/forum-(w+)-([0-9]+).html?*(.*)$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&$4
13 RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html?*(.*)$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5
14 RewriteRule ^(.*)/group-([0-9]+)-([0-9]+).html?*(.*)$ $1/forum.php?mod=group&fid=$2&page=$3&$4
15 RewriteRule ^(.*)/space-(username|uid)-(.+).html?*(.*)$ $1/home.php?mod=space&$2=$3&$4
16 RewriteRule ^(.*)/([a-z]+)-(.+).html?*(.*)$ $1/$2.php?rewrite=$3&$4

4. Zeus Web Server

 
01 match URL into $ with ^(.*)/topic-(.+).html?*(.*)$
02 if matched then
03         set URL = $1/portal.php?mod=topic&topic=$2&$3
04 endif
05 match URL into $ with ^(.*)/article-([0-9]+)-([0-9]+).html?*(.*)$
06 if matched then
07         set URL = $1/portal.php?mod=view&aid=$2&page=$3&$4
08 endif
09 match URL into $ with ^(.*)/forum-(w+)-([0-9]+).html?*(.*)$
10 if matched then
11         set URL = $1/forum.php?mod=forumdisplay&fid=$2&page=$3&$4
12 endif
13 match URL into $ with ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html?*(.*)$
14 if matched then
15         set URL = $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5
16 endif
17 match URL into $ with ^(.*)/group-([0-9]+)-([0-9]+).html?*(.*)$
18 if matched then
19         set URL = $1/forum.php?mod=group&fid=$2&page=$3&$4
20 endif
21 match URL into $ with ^(.*)/space-(username|uid)-(.+).html?*(.*)$
22 if matched then
23         set URL = $1/home.php?mod=space&$2=$3&$4
24 endif
25 match URL into $ with ^(.*)/([a-z]+)-(.+).html?*(.*)$
26 if matched then
27         set URL = $1/$2.php?rewrite=$3&$4
28 endif

5. Nginx Web Server

 
01 rewrite ^([^.]*)/topic-(.+).html$ $1/portal.php?mod=topic&topic=$2 last;
02 rewrite ^([^.]*)/article-([0-9]+)-([0-9]+).html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
03 rewrite ^([^.]*)/forum-(w+)-([0-9]+).html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
04 rewrite ^([^.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
05 rewrite ^([^.]*)/group-([0-9]+)-([0-9]+).html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
06 rewrite ^([^.]*)/space-(username|uid)-(.+).html$ $1/home.php?mod=space&$2=$3 last;
07 rewrite ^([^.]*)/([a-z]+)-(.+).html$ $1/$2.php?rewrite=$3 last;
08 if (!-e $request_filename) {
09         return 404;
10 }