<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19298">
<STYLE>@font-face {
        font-family: 宋体;
}
@font-face {
        font-family: Verdana;
}
@font-face {
        font-family: @宋体;
}
@page Section1 {size: 595.3pt 841.9pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; layout-grid: 15.6pt; }
P.MsoNormal {
        TEXT-JUSTIFY: inter-ideograph; TEXT-ALIGN: justify; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; FONT-SIZE: 10.5pt
}
LI.MsoNormal {
        TEXT-JUSTIFY: inter-ideograph; TEXT-ALIGN: justify; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; FONT-SIZE: 10.5pt
}
DIV.MsoNormal {
        TEXT-JUSTIFY: inter-ideograph; TEXT-ALIGN: justify; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; FONT-SIZE: 10.5pt
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
        FONT-STYLE: normal; FONT-FAMILY: Verdana; COLOR: windowtext; FONT-WEIGHT: normal; TEXT-DECORATION: none; mso-style-type: personal-compose
}
DIV.Section1 {
        page: Section1
}
UNKNOWN {
        FONT-SIZE: 10pt
}
BLOCKQUOTE {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</STYLE>
</HEAD>
<BODY style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt">
<DIV><FONT color=#000080 size=2 face=Verdana>Thank you very much .It 
works.</FONT></DIV>
<DIV><FONT color=#000080>But there is another problem.</FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080>
<DIV>I want  </DIV>
<DIV>http://www.mysite.com/bbs/</DIV>
<DIV>to</DIV>
<DIV><A href="http://www.mysite.com/">http://www.mysite.com/</A></DIV>
<DIV> </DIV>
<DIV>why the following conf does not work?</DIV>
<DIV>rewrite ^/bbs/$   /index.php  last;</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV></DIV>
<DIV></DIV>
<DIV>I want  </DIV>
<DIV>http://www.mysite.com/bbs/thread-4270-1-2.html</DIV>
<DIV>to</DIV>
<DIV><A 
href="http://www.mysite.com/forum.php?mod=viewthread&tid=4270&extra=1&page=2">http://www.mysite.com/forum.php?mod=viewthread&tid=4270&extra=1&page=2</A></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>why the following conf does not work?</DIV>
<DIV>location ~* ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ {</DIV>
<DIV>    rewrite ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$   /forum.php?mod=viewthread&tid=$1&extra=$2&page=$3 break;</DIV>
<DIV>}</DIV></FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080>Thank you !</FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Verdana></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Verdana></FONT> </DIV>
<DIV><FONT size=2 face=Verdana>
<DIV>Hello!</DIV>
<DIV></DIV>
<DIV>On Tue, Sep 04, 2012 at 10:59:40AM +0800, sosogh wrote:</DIV>
<DIV></DIV>
<DIV>> HI list</DIV>
<DIV>> I want to redirect</DIV>
<DIV>> http://www.mysite.com/bbs/viewthread.php?tid=8123&extra=</DIV>
<DIV>> to</DIV>
<DIV>> http://www.mysite.com/forum.php?mod=viewthread&tid=8123</DIV>
<DIV>>  </DIV>
<DIV>> This is what I  place in the "server" block in the nginx.conf</DIV>
<DIV>> rewrite  ^/bbs/viewthread.php?tid=([0-9]+).*$   /forum.php?mod=viewthread&tid=$1 last;</DIV>
<DIV>>  </DIV>
<DIV>> but when visit http://www.mysite.com/bbs/viewthread.php?tid=8123&extra=.</DIV>
<DIV>> It shows 404 error.</DIV>
<DIV>>  </DIV>
<DIV>> Could anyone point me out what is wrong?</DIV>
<DIV>> Thank you!</DIV>
<DIV></DIV>
<DIV>The rewrite in question won't match anything as rewrite work with </DIV>
<DIV>URI without arguments.  Use something like this instead:</DIV>
<DIV></DIV>
<DIV>location = /bbs/viewthread.php {</DIV>
<DIV>    if ($arg_tid ~ ^[0-9]+$) {</DIV>
<DIV>        rewrite ^ /forum.php?mod=viewthread&tid=$arg_tid? last;</DIV>
<DIV>    }</DIV>
<DIV></DIV>
<DIV>    ...</DIV>
<DIV>}</DIV>
<DIV></DIV>
<DIV>Some more details may be found here:</DIV>
<DIV></DIV>
<DIV>http://nginx.org/r/location</DIV>
<DIV>http://nginx.org/r/rewrite</DIV>
<DIV>http://nginx.org/r/if</DIV>
<DIV></DIV>
<DIV>Maxim Dounin</DIV>
<DIV></DIV>
<DIV>_______________________________________________</DIV>
<DIV>nginx mailing list</DIV>
<DIV>nginx@nginx.org</DIV>
<DIV>http://mailman.nginx.org/mailman/listinfo/nginx</DIV></FONT></DIV></BODY></HTML>