程序方 2017-09-29 17:01:42

rewrite ^/(.+)/$ /category.php?Catid=$1 last;

rewrite ^/([^\/]+)/([0-9]+).html$ /information.php?id=$2 last;
rewrite ^/news.html$ /news.php last;
rewrite ^/news-id-([0-9]+).html$ /news.php?id=$1 last;
rewrite ^/news-catid-([0-9]+).html$ /news.php?catid=$1 last;
rewrite ^/news-catid-([0-9]+)-page-([0-9]+).html$ /news.php?catid=$1&page=$2 last;
rewrite ^/goods.html$ /goods.php last;
rewrite ^/goods-id-([0-9]+).html$ /goods.php?id=$1 last;
rewrite ^/goods-([^\/]+).html$ /goods.php?Catid=$1 last;
rewrite ^/corporation.html$ /corporation.php last;
rewrite ^/corporation-([^\/]+).html$ /corporation.php?Catid=$1 last;
rewrite ^/aboutus.html$ /about.php?part=aboutus last;
rewrite ^/sitemap.html$ /about.php?part=sitemap last;
rewrite ^/aboutus-id-([0-9]+).html$ /about.php?part=aboutus&id=$1 last;
rewrite ^/announce.html$ /about.php?part=announce&id=$1 last;
rewrite ^/faq.html$ /about.php?part=faq last;
rewrite ^/faq-id-([0-9]+).html$ /about.php?part=faq&id=$1 last;
rewrite ^/friendlink.html$ /about.php?part=friendlink last;
rewrite ^/space/(.+)/$ /space.php?user=$1 last;
rewrite ^/store-([0-9]+)/$ /store.php?uid=$1 last;
rewrite ^/store-([0-9]+)/([^\/]+).html$ /store.php?uid=$1&Uid=$2 last;
if (!-e $request_filename) {
return 404;
}
if ( $host ~* (\b(?!www\b)\w+)\.\w+\.\w+ ) {
set $domain $1;
rewrite ^(.*)/(.*).php(.*)$ /city/$domain/$2.php$3 last;
}
上面是Nginx多城市二级域名使用的伪静态规则,如果是目录要相应的调整
发表评论