Q2A apache转为nginx后规则设置

2020-10-16 14:28:21 2620 阅读 开发实例与经验 #Q2A

Q2A apache转为nginx后,若要伪静态继续生效,则在配置文件中添加:

location / {
        index index.php index.html index.htm;
        if (!-f $request_filename) {
            rewrite ^/(.+)?$ /index.php?qa-rewrite=$1 last;
        }
    }
    location /index {
        rewrite ^/index/([^/]+)/([^/]+)/([^/]+) /index.php?qa=$1&qa_1=$2;
    }

便可以解决nginx下的伪静态问题。