我正在尝试用nginx重写一个url,但它下载了php文件而不是传递它
https://www.example.com/s.php?k=7eqx6si58Mn4fBf8n9oiF9lwIQ%3D%3D&b=5
需要显示为
https://www.example.com/s/7eqx6si58Mn4fBf8n9oiF9lwIQ%3D%3D&b=5
我尝试了以下但是它不能正常工作
location ~ ^/s.php(.*)$ {
rewrite ^/s/$ /s.php?k= last;
}
我还有以下位置块
location ~* \.php$ {
root /var/www/example.com/public_html/www;
try_files $uri =404;
fastcgi_pass unix:/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}