Rename site: will the old URL redirect?

I have an existing website that I didn’t name myself.
It just got an auto-generated name: heuristic-torvalds-3c6c99.
The problem is that this is also the site’s URL: heuristic-torvalds-3c6c99.netlify.app

What happens when I rename this site?
I guess the URL will also change?
Will the old URL automatically redirect to the new one?
Or do I have to configure that myself?
Is that even possible?

Hi @johanvanmol :wave:t6: , welcome to the forums and thank you so much for reaching out.

Yes, if you rename the site in Netlify, the site’s URL will also change.

Unfortunately, the old URL (heuristic-torvalds-3c6c99.netlify.app) will not automatically redirect to the new one. This is because the URL is tied to the site’s name, and changing the name changes the URL. As a result, visitors who try to access the old URL will receive a “Page not found” error. You will need to manually set up a redirect rule from your old URL to your new site.

Here is a super helpful guide for redirects to help you set this up!

Thank you for your feedback.
I managed to solve my problem, but not in an elegant way.

I wanted to redirect https://heuristic-torvalds-3c6c99.netlify.app to https://geoit.netlify.app.

I renamed “heuristic-torvalds-3c6c99” to “geoit”.
The site was imediately available via https://geoit.netlify.app.
https://heuristic-torvalds-3c6c99.netlify.app gave a “site not found” error.

That also meant that this didn’t work:

(in netlify.toml):
[[redirects]]
from = “https://heuristic-torvalds-3c6c99.netlify.app/
to = “https://geoit.netlify.app/
status = 301
force = true

I had to create a new site, that reused the old name “heuristic-torvalds-3c6c99”,
and add the netlify.toml file there.

So now it works, but I have an extra Netlify site that only exists to redirect.
It’s completely empty, except for a netlify.toml file.

Thank you for sharing your solution. I’m curious; what happens when you delete the blank site,