Mod rewrite 在url中设置nginx更改参数
如何更改url中的参数Mod rewrite 在url中设置nginx更改参数,mod-rewrite,nginx,Mod Rewrite,Nginx,如何更改url中的参数 e、 ghttps://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
e、 g
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文件中?如果URI没有映射到本地文件,则try\u files的最后一个元素是默认操作。因此,用所需的重写替换404错误。尝试:
location / {
try_files $uri $uri/ /r.php?$uri;
}
有关详细信息,请参阅。如果URI未映射到本地文件,则
try\u files
的最后一个元素是默认操作。因此,用所需的重写替换404错误。尝试:
location / {
try_files $uri $uri/ /r.php?$uri;
}
有关详细信息,请参阅