How to redirect root?

I have a website: gavinpereira.in
I recently bought the domain gavn.in to use as a link shortener of sorts.
My intention is that, if gavn.in/contact is opened, it should redirect to gavinpereira.in/contact

The _redirects file looks like this:

/ https://gavinpereira.in/
/* https://gavinpereira.in/:splat 

Everything works fine, but if you try opening gavn.in/ fails to take you to gavinpereira.in.
What could be the issue and how do I fix it?

Netlify site: gavnin.netlify.app

Hey @pexeixv

Do you have an index.html file deployed with gavn.in? If so you will need to force the redirect.

E.G.

/    https://gavinpereira.in    301!

If deploying as a shortener with everything redirecting (including the domain root), you can deploy without an index.html.

Hey @coelmay
I did try deploying without index.html, but it gets stuck on uploading. That’s why I had to create an empty index file.

I was able to fix it with the line above.
However, I still have to upload an empty index.html so that it’s not stuck on uploading.

Appears something has changed since I last tested this and the index.html is required.

Do not also you only need the one rule

/*   https://gavinpereira.in/:splat   301!

as this covers the domain root as well.

The rule

/   https://gavinpereira.in  301!

is redundant.

1 Like