日安,请告诉我如何从网站的主页上删除GET请求的参数,以便处理其余的参数。也就是说,如果在请求时主页上有任何参数,则重定向到不带参数的站点。
server {
listen 80;
listen [::]:80;
root /var/www/public_html/public;
index index.php index.html index.htm;
server_name mysite.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}
}
发布于 2021-03-11 23:01:21
未经过测试,但下面几行中的一些内容应该会对您有所帮助
server {
listen 80;
listen [::]:80;
root /var/www/public_html/public;
index index.php index.html index.htm;
server_name mysite.com;
location / {
location = / {
if ($is_args)
rewrite / permanent;
try_files $uri $uri/ /index.php?$query_string;
}
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
#include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}
}
https://stackoverflow.com/questions/66584625
复制相似问题