小编Nic*_*_be的帖子

Nginx 重写:从带有参数的 URL 中删除 .html

如何从带有参数的 url 中删除 .html?

例如:http : //www.domain.com/somepage.html?argument= whole& bunch=a-lot

到:

http://www.domain.com/somepage?argument=whole&bunch=a-lot

我试过了

    location / {
    index index.html index.php; 
            rewrite ^\.html(.*)$ $1 last;
            try_files $uri $uri/ @handler; 
            expires 30d; ## Assume all files are cachable
     }
Run Code Online (Sandbox Code Playgroud)

和一堆其他建议,但似乎无法让它发挥作用....

Tnx

rewrite nginx

4
推荐指数
1
解决办法
5965
查看次数

标签 统计

nginx ×1

rewrite ×1