Discuz! X2.5 伪静态 rewrite 在IIS7 和nginx 中的配置方法(图文)

下一篇:很抱歉没有了

IIS7 Web Server(独立主机用户)

可以将如下的配置规则加入到 web.config 中

<rewrite>
<rules>
  <rule name="portal_topic">
   <match url="^(.*/)*topic-(.+).html?*(.*)$" />
   <action type="Rewrite" url="{R:1}/portal.php?mod=topic&amp;topic={R:2}&amp;{R:3}" />
  </rule>
  <rule name="forum_forumdisplay">
   <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="forum_viewthread">
   <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="group_group">
   <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="home_space">
   <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="forum_archiver">
   <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>

 

Nginx Web Server

配置规则如下:

rewrite ^([^.]*)/topic-(.+).html$ $1/portal.php?mod=topic&topic=$2 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 ^([^.]*)/(fid|tid)-([0-9]+).html$ $1/index.php?action=$2&value=$3 last;
if (!-e $request_filename) {
return 404;
}

 

来源://作者:/更新时间:2013-01-22
相关文章
评论:
验证码:
匿名评论:

最新文章

新热推荐

文章排行