Moving to a new domain name - setting up redirects

I host my app’s website on Netlify, and I’m planning to move from using timelinesapp.io to timelines.app. So far only timelinesapp.io is using Netlify’s DNS servers, but I’ll add timelines.app too.

My question is: to set up the automatic redirect for all the links on the old domain to point to the new domain, is there something more that I need to do than just using this in my _redirects file?

https://timelinesapp.io/* https://timelines.app:/splat 301

Note: my website uses https (also managed by Netlify). Do I need to have some special redirect for that too?

I have read the Netlify’s docs about this and they were very helpful, but I want to find out as much information as I can to make sure I get this right. I have never moved to a new domain like that before, and I’m worried that my website will lose google rankings if I don’t do this correctly.

Thank you so much for your help!

Hi, @Lukas_Petr, and welcome to the Netlify community site.

In most cases I would recommend making that rule a “forced” redirect rule like so:

https://timelinesapp.io/* https://timelines.app:/splat 301!

The “!” after the 301 is required if you want to force redirects for existing URLs/assets. If the rule is 301 without the “!”, the redirect only occurs when the file or URL doesn’t exist at the first path.

Besides that, the rule is correct.

If can be helpful to have a rule redirecting any HTTP attempts to HTTPS at the new domain also. This requires the rule above plus a second version for HTTP like so (both rules shown below):

http://timelinesapp.io/*  https://timelines.app:/splat 301!
https://timelinesapp.io/* https://timelines.app:/splat 301!
  • Note: Both rules should redirect to HTTPS.

​Please let us know if there are other questions. :smiley:

Thank you, Luke, this is very helpful. The redirect from the http version of the old domain directly to the https version of the new domain makes sense; I assume that if I didn’t have it there, there would be two redirects happening instead.

Since you mentioned it: I do have other questions too. Currently, I’m using these redirects:

/index.html				/
/blog					https://blog.timelinesapp.io
/ ref=producthunt		/

# App updates blog articles

/whatsNew v=:version  	/whatsNew/:version  301

/whatsNew/1.1			https://blog.timelinesapp.io/whats-new-in-timelines-1-1?ref=whatsNewAlert		301
/whatsNew/1.2			https://blog.timelinesapp.io/timelines-1-2-brings-archiving-simultaneous-timers-and-more?ref=whatsNewAlert  301
/whatsNew/1.3			https://blog.timelinesapp.io/timelines-1-3-is-here-reminders-statistics-snapping-and-more/?ref=whatsNewAlert 301
/whatsNew/1.4			https://blog.timelinesapp.io/update-1-4					301
/whatsNew/1.5			https://blog.timelinesapp.io/update-1-5					301

Will those be impacted in any way? For the blog.timelinesapp.io, I’m using another hosting, so, I will handle those there, but I’m more interested in the ‘dance’ between going from /whatsNew?v=1.1 to /whatsNew/1.1.

Also, I keep getting emails from Netlify about changed behavior for redirects, and it seems to me that I should be able to just add exclamation mark to all the redirects related to blog posts, just to make sure that the redirect is forced. But for the first three redirects - how should I handle those?

Thank you so much for your help.

hi there, @Lukas_Petr , thank you for your patience. We haven’t forgotten about you! We have had lots of questions about redirects lately - we will try and get back to you as soon as we can.

Sorry we didn’t get back to you sooner!

I can see your redirects seem to be working well on the site. The main thing that would have been affected there is that you do not have a force=true or ! (per https://docs.netlify.com/routing/redirects/rewrites-proxies/#shadowing) in case you do have files under the path of some redirect - such as /index.html which is there, so you’ll probably want the ! there and on the third one too.

AFAICT since you don’t use a * and :splat this is probably not going to affect you otherwise, unless you are literally trying to override an existing file like /whatsNew.html or /blog.html