【发布时间】:2019-06-17 04:00:01
【问题描述】:
我有这个 NGINX 配置:
root /var/www/web;
index index.php;
server_name domain.com;
access_log off;
error_log on;
location / {
rewrite ^/(.*)$ /index.php?tag=$1&page=1 last;
}
现在,我想重定向网址,例如 "domain.com/index.php?tag=1§ion=2&type=3" 到 "domain.com/tag/section/type"
我该怎么做,我应该把代码放在哪里?请帮忙,
谢谢
我已经试过了:
location / {
rewrite ^/index\.php?tag=(.*)§ion=(.*)&type=(.*)$ /$1/$2/$3 permanent;
rewrite ^/(.*)$ /index.php?tag=$1&page=1 last;
}
但它没有工作..
【问题讨论】:
-
变量呢?我应该为重定向写什么?我试过了,还是不行。。
标签: linux nginx configuration webserver