Add slash to the end of every url (need rewrite rule for nginx)

前端 未结 9 891
慢半拍i
慢半拍i 2020-11-28 03:28

I try to get an \"/\" to every urls end:

example.com/art

should

example.com/art/

I use nginx as webserver.

I need the rewrite rule f

9条回答
  •  囚心锁ツ
    2020-11-28 03:49

    using the rewrites from anthonysomerset in a Wordpress, I experimented problems accesing to /wp-admin dashboard due to reirection loop. But i solve this problem using the above conditional:

    if ($request_uri !~ "^/wp-admin")
    {
    rewrite ^([^.]*[^/])$ $1/ permanent;
    rewrite ^([^.]*)$ /index.php;
    }
    

提交回复
热议问题