remove .php from url with rewrite rule

前端 未结 3 971
梦毁少年i
梦毁少年i 2021-01-24 13:00

I want to rewrite the url in nginx so that the .php extension can be omitted.

This is what I have, but this isn\'t working for me. Anyone any idea how to do

3条回答
  •  借酒劲吻你
    2021-01-24 14:00

    Something like this should be what you are looking for.

    location ^/(.*)$ {
      rewrite ^(.*)$ /$1.php;
    }
    

提交回复
热议问题