Home
Support Forums

How do I set Up a Redirect from ig subdomain to my instagram account?

Hi all.
My domain is Fruttec.com.co it is on netlify dns.
I want the subdomain ig.fruttec.com.co redirect to Login • Instagram

In netlify dns I created a cname for ig pointing to Fruttec.com.co

And in netlify.toml I created a redirect:

[[redirects]]
from = “https://ig.fruttec.com.co
to = “Login • Instagram
status = 200
force = true

However it is not working. it trows me an error:

Not found - Request ID: 01FAY2J2ZQ6DG8QANZGQBN4D9F

Your help is very much appreciated

Rather than setting up a subdomain to redirect, a better solution is to use a /path ie.

[[redirects]]
  from = "/ig"
  to = "https://instagram.com/soyfruttec"
  status = 200
  force = true

Hi @coelmay , thanks for your reply.
Yes I’ve tried path redirects and they work.
We were used to subdomain redirects and was wondering if it was possible to implement them in netlify, and how.
Thanks

I still don’t know why you need to use a subdomain. A lot harder to implement and manage.

I don’t believe it will work the way you want.

Hi, @iamdagy. There are two things (well … definitely one - maybe two) changed needed to get this working:

  1. Add the domain name (ig.fruttec.com.co) to the site’s custom domains"settings under Site Name > Settings > Domain management > Custom domains in the web UI.

  2. You will probably (this is the maybe) want to make that redirect rule a 301 and not a 200 proxy rule.

If you want anything at the subdomain ig under apex fruttec.com.co to be redirected to the Instagram page, you muse use a rule like this:

[[redirects]]
  from = "https://ig.fruttec.com.co/*"
  to = "https://instagram.com/soyfruttec"
  force= true

[[redirects]]
  from = "http://ig.fruttec.com.co/*"
  to = "https://instagram.com/soyfruttec"
  force= true

These rules above say that for any HTTP or HTTPS requests to this subdomain, always return a 301 redirect with the location header in the 301 redirect set to https://instagram.com/soyfruttec.

If that doesn’t do what you want it to do or if there are other questions, please let us know.

@luke Thanks a lot!! adding the subdomain as a domain alias in the web UI did the Trick!!
I will explore what works better between 301 and 200 redirects.
Thanks a lot

Hi @luke ,
Funny thing, now my redirect to the functions stop working 🥲
ˆhave this
[[redirects]]
from = “api/*”
to= “.netlify/functions/:splat”
status = 200

and it was working until I made the changes for the subdomain…

what should I do?

Change

to= ".netlify/functions/:splat"

to

to = "/.netlify/functions/:splat"
1 Like

Hi @coelmay that was it ! thanks, I was wrong thinking it was related to the subdomain redirects. Thanks a lot

1 Like