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
            }
        ]
    }
};

asked 2 years ago64 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions