why the following conf does not work?
location ~* ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ {
rewrite ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+).html$
/forum.php?mod=viewthread&tid=$1&extra=$2&page=$3 break;
}
Thank you !
Hello!
On Tue, Sep 04, 2012 at 10:59:40AM +0800, sosogh wrote:
It shows 404 error.
Could anyone point me out what is wrong?
Thank you!
The rewrite in question won’t match anything as rewrite work with
URI without arguments. Use something like this instead:
location = /bbs/viewthread.php {
if ($arg_tid ~ ^[0-9]+$) {
rewrite ^ /forum.php?mod=viewthread&tid=$arg_tid? last;
}
…
}
Some more details may be found here: http://nginx.org/r/location http://nginx.org/r/rewrite http://nginx.org/r/if
Maxim D.
why the following conf does not work?
location ~* ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ {
rewrite ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+).html$
/forum.php?mod=viewthread&tid=$1&extra=$2&page=$3 break;
}
This will likely result in /forum.php source code being returned as
you use “break” and doesn’t handle php in the location in
question. See http://nginx.org/r/rewrite for details.
Maxim D.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.