if ( $host ~* www\.domain\.com )
{
rewrite ^/soft-(\d+)\.html /index.php?m=view&id=$1 last;
rewrite ^/today\.html /index.php?m=today last;
rewrite ^/today-(\d+)\.html /index.php?m=today&p=$1 last;
rewrite ^/search/(.+) /index.php?m=search&k=$1 last;
}
将一些不存在的URL重定向时会与error_page有冲突,所以要将error_page放在最下面,这样就会先匹配rewrite规则。
{
rewrite ^/soft-(\d+)\.html /index.php?m=view&id=$1 last;
rewrite ^/today\.html /index.php?m=today last;
rewrite ^/today-(\d+)\.html /index.php?m=today&p=$1 last;
rewrite ^/search/(.+) /index.php?m=search&k=$1 last;
}
将一些不存在的URL重定向时会与error_page有冲突,所以要将error_page放在最下面,这样就会先匹配rewrite规则。