Nginx下设置伪静态方法与Apache差不多,直接在nginx.conf (或者在对应的*.conf)
中找到需设置伪静态规则的服务器对应字段,在server{ location/{ } }中添加以下代码:
server { listen 80 default_server; server_name _; location / { root /usr/share/nginx/html; index index.html index.htm; rewrite ^(.*)list-([0-9]+)-([0-9]+)\.html$ $1list.php?page=$2&id=$3; } }
添加后重启Nginx服务即可生效!