Nuxt.js - force trailing slash at the end of all urls

后端 未结 2 1946
遥遥无期
遥遥无期 2021-01-21 07:04

I\'m looking for a way to make sure that all of my urls end with a trailing slash (so first check if there is already a trailing slash at the end, and if not add one).

I

2条回答
  •  无人共我
    2021-01-21 07:24

    You can try to match only those URLs that do not end with a slash:

    redirect: [
        {
            from: '^.*(? req.url + '/'
        }
    ]
    

提交回复
热议问题