如何更改url中的参数
比如https://example.com/r.php?12345到https://example.com/12345?
nginx conf文件:
server {
listen 80;
server_name example.com;
rewrite_log on;
# note that these lines are originally from the "location /" block
root /usr/share/nginx/example.com;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}在conf文件中添加块的位置呢?
发布于 2015-12-25 09:22:40
如果URI不映射到本地文件,则try_files的最后一个元素是默认操作。因此,将404错误替换为所需的重写。尝试:
location / {
try_files $uri $uri/ /r.php?$uri;
}详情请参见本文件。
https://stackoverflow.com/questions/34459492
复制相似问题