Set up a 301 from a .netlify.app to a new site

I have a site built out on the free tier so it’s hosted with .netlify.app. I’m considering buying a domain from Netlify but I was wondering if it’s possible to set up a 301 redirect from the current URL to the purchased URL so that it doesn’t affect my existing users. Is that at all possible or will I just have to find a way to manually inform users about the domain change? For other persons who may have similar questions in the future:

TL;DR;

  • Can I purchase a domain with Netlify and then set up a 301 if my the site was developed on the free Netlify tier in the first place?

  • Can I purchase a domain outside Netlify and then set up a 301 if my the site was developed on the free Netlify tier in the first place?

Hi, @simeon9696, yes to both questions. This will work regardless of where you register your domain.

Let’s take a Netlify site subdomain of my-site.netlify.app and custom domain registered as example.com with the primary domain set to the www subdomain (www.example.com).

With that example the redirects rules needed would be these below (in _redirects format) :

http://my-site.netlify.app/* https://www.example.com/:splat 301!
https://my-site.netlify.app/* https://www.example.com/:splat 301!

Again, this will work regardless of where the domain is registered.

If there are other questions about this, please let us know.

1 Like

Just one question, is splat a page name or necessary syntax in your example?

EDIT: I got the domain and everything, including adding the redirect as per your example was just, seamless

1 Like

splat is not a page name! (that would be kinda cute)

1 Like