Redirect netlify.app to custom domain

Hello,
I have https://okradze.com
But my website is also available on https://okradze.netlify.app
I am using Netlify DNS

How to configure here to redirect to custom domain

hi there,

if you set up your custom domain correctly, it will point to https://okradze.netlify.app .

Your site will also still be available under the https://okradze.netlify.app/ URL if someone types that in, there is no way to remove that, as the system requires it.

It definitely looks like https://okradze.com is set up correctly :+1:

Does this answer your question?

Is there a way to redirect okradze.netlify.app to okradze.com?

You can do it in JavaScript if you can get the following code into your page somehow:

if (location.hostname.endsWith('netlify.app')) {
    location.replace(`https://okradze.com${location.pathname}`);
}

You can see it in action here: Testing / Andromeda

@perry I haven’t personally tried, but isn’t that something you could do with _redirects since both domains are applied to the site and should be treated the same?

http://foo.netlify.app http://foo.com 301! or etc.?

Hi, @okradzemirian, I’m chiming in to +1 , @jonsully’s solution above. (I see you have already marked that a the solution as well.)

Thanks for answering, @jonsully! :+1:

1 Like