Redirection Rules

Greetings,

I’m trying to solve a problem in my current app, we just have released the app with another name and trying to redirect our existing/new users to the newer domain. For this we have altered _redirect file and add a redirection rule which is something like this

/* http://newerdomain.com/

its working as expected for the / (root) request. Forexample if someone access https://olderdomain.com he gets redirected to https://newerdomain.com the probelm happens when someone tries to access any page other than root…

For example https://olderdomain.com/signup lands the user on https://newerdomain.com/signup I want my user to land on https://newerdomain.com notice the missing /signup part, I do not need it there. Can someone please guide me whats wrong with my redirection rule? Is there anything I can do to achieve the expected behavior?

Hi @tahaahmed, thanks for posting and welcome.
Kindly try the code below in the redirects file to see if it works.

https://olderdomain.com/* http://newerdomain.com

Let me know the outcome.
Thanks.

Hi @clarnx, unfortunately the proposed solution didn’t work. Its still producing the same result i.e. olderdomain.com/custom-page tries to redirect me to newerDomain.com/custom-page.

Any further help to resolve this issue would be highly appreciated :blush:

Hi @tahaahmed, thanks for the feedback.
Kindly try the below.

https://olderdomain.com/* https://newerdomain.com/ 301!

Thanks.

Thanks for the quick response @clarnx.

No luck with the redirection code as well. I was wondering if there’s some cache mechanism due to which these changes are not getting reflected? Is there any cache busting mechanism I can try?

Hello @tahaahmed,
If possible can you share a code snippet of your _redirects file.

Also if possible can you share the repository of the old site. It’s possible the _redirects file is in the wrong location.

What framework are you using on your old site?

Finally make sure the file name is _redirects

Thanks.

The content of _redirects file

https://zir-ai.com/* https://vectara.com/* 301!

The old website is zir-ai.com, _redirects file seem to be in right location. The original content of this file was

/* /index.html

Its a create-react-app based project, the prod build is generated and deployed on netlify.

I’ve confirmed the name of the file, its _redirects

One important thing I nticed, I changed the content of this _redirects file to default, its still redirect me from zir-ai.com to vectara.com

Now I can surely say its some caching stuff going on.

Hi @tahaahmed

Since you originally stated you just want the old site to redirect to the old site and not other URL paths of the old site, kindly edit your current redirects content to the code below.

/* https://vectara.com 301!

Make the changes and let me know the outcome.
Thanks.