论坛 修改.htaccess加入如下代码:
RewriteEngine On
# 修改以下语句中的 /x 为你的论坛目录地址,如果程序放在根目录中,请将 /x 修改为 /
RewriteBase /x
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(forumdisplay|viewthread|redirect|faq)/.php forum.php?mod=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(space)/.php home.php?mod=$1&%1
升级到Discuz!X后 保持UCHOME原链接可正常访问rewrite
RewriteRule ^(.*)/space-(/d+)-do-(.+)-(.+)-([0-9]+).html/?*(.*)$ $1/home/.php/?mod=space&uid=$2&do=$3&$4=$5
RewriteRule ^(.*)/space-mtag.html/?*(.*)$ $1/group/.php
RewriteRule ^(.*)/space-event.html/?*(.*)$ $1/home/.php/?mod=space&do=activity
RewriteRule ^(.*)/space-(.*).html/?*(.*)$ $1/home/.php/?mod=space&do=$2
论坛Nginx的写法:
rewrite ^(.*)/(forumdisplay|viewthread|redirect|faq)/.php $1/forum.php?mod=$2&$query_string last;
rewrite ^(.*)/(space)/.php $1/home.php?mod=$2&$query_string last;
iis6下规则
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteRule ^(.*)/(forumdisplay|viewthread|redirect|faq)/.php/?(.*) $1/forum/.php/?mod=$2&$3
RewriteRule ^(.*)/(space)/.php/?(.*) $1/home/.php/?mod=$2&$3
iis7下规则加在web.config里面
<rule name="for_bbs">
<match url="^(.*)/(forumdisplay|viewthread|redirect|faq).php" />
<action type="Rewrite" url="{R:1}/forum.php?mod={R:2}&%{QUERY_STRING}" />
</rule>
<rule name="for_uchome">
<match url="^(.*)/(space).php" />
<action type="Rewrite" url="{R:1}/home.php?mod={R:2}&%{QUERY_STRING}" />
</rule>
apache独立主机
<IfModule mod_rewrite.c>
RewriteRule ^(.*)/(forumdisplay|viewthread|redirect|faq)/.php $1/forum.php?mod=$2&%{QUERY_STRING}
RewriteRule ^(.*)/(space)/.php $1/home.php?mod=$2&%{QUERY_STRING}
</IfModule>
对于源程序在bbs文件夹,升级后在根目录了,保持原链接不失效的方法
RewriteEngine On
# 修改以下语句中的 /x 为你的论坛目录地址,如果程序放在根目录中,请将 /x 修改为 /
RewriteBase /
RewriteRule ^bbs(.*)$ http://www.violinstudy.net$1 [R]
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(forumdisplay|viewthread|redirect|faq)/.php forum.php?mod=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(space)/.php home.php?mod=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)/.html$ portal.php?mod=topic&topic=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-([0-9]+)-([0-9]+)/.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(/w+)-([0-9]+)/.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)/.html$ forum.php?mod=viewthread&tid=$1&extra=page/%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+)/.html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+)/.html$ home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+)-(.+)/.html$ $1.php?rewrite=$2&%1
此文由 网站目录_网站网址收录与提交入口 编辑,未经允许不得转载!: