2016-11-06 11:08:27 nginx伪静态的规则示例代码
nginx伪静态的规则示例代码如下:
nginx的规则相对apache来说确实要易懂一些,毕竟要nginx考虑的方面可能比apache少,会更灵活,伪静态也是如此。代码如下:
location / {
rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;