Amplify Next.js Redirects

0

Hi! I have a trouble with aws amplify redirects. I want, if enter to my app by phone it should redirect to phone version. For example when user enter to https://alifshop.tj/?query it should redirect to https://m.alifshop.tj/?query . On next.js I did it. And it works on my local machine. But doesn't work on AWS Amplify. But on Amplify doesn't work the condition. In any case it redirects.

Please help!

module.exports = {
    async redirects() {
        return [
            {
                source: '/(.*)',
                has: [
                    {
                        type: 'header',
                        key: 'User-Agent',
                        value:
                            'Mobile|Android|BlackBerry'
                    }
                ],
                destination: 'https://m.alifshop.tj',
                permanent: false
            }
        ]
    }
};

已提问 2 年前64 查看次数
没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则