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

后端 未结 2 1962
遥遥无期
遥遥无期 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:22

    The following regex handles query string as well:

    redirect: [
        {
            from: '^(\\/[^\\?]*[^\\/])(\\?.*)?$',
            to: '$1/$2',
        },
    ],
    

提交回复
热议问题