rewrite nginx
两个条件,组合控制
# if ($query_string ~* "mod=viewthread&tid=([0-9]+)((&highlight=(.*))|(&extra=(.*)))?$")
# {
# set $itid $1;
# rewrite ^([^\.]*)/forum\.php$ http://xxx.xxx.com/thread-$itid-1-1.html? permanent;
# }
set $has_authorid '0';
set $itid '0';
if ($query_string ~* "&authorid=")
{
set $has_authorid '1';
}
if ($query_string ~* "mod=viewthread&tid=([0-9]+)((&highlight=(.*))|(&extra=(.*)))?$")
{
set $itid $1;
}
set $redirect_thread "$has_authorid$itid";
if ($redirect_thread ~ '0([1-9]\d+)')
{
rewrite ^([^\.]*)/forum\.php$ http://xxx.xxx.com/thread-$itid-1-1.html? permanent;
}