I have a website that is hosted on a webhost and static website on netlify.
When I share a link on facebook (with netlify subdomain) and a guest clicks on it I want it to redirect from netlify subdomain on main domain without netlify.
Sounds like you are wanting to set up a Domain-level redirect as found in the Netlify docs.
In essence you create a _redirects file in your publish directory and add https://cranky-goldwasser-dfce5c.netlify.app/* https://amanuntul.ro/:splat 301!
Hi! I have created the _redirects file but no succes… where I need to create this file, in public_html of a wordpress website or on static website on netlify?
If you want your <your-site>.netlify.app domain redirected to your custom-domain.com you need to put the _redirects file inside the directory you publish to Netlify.
The file is created. Post is here published on Facebook Aromabio.ro but when I click on the post it’s the same domain not redirecting me to main domain.
I want to keep netlify subdomain for facebook posts but when someone clicks on the post go to main domain.
I’ve seen this weird trend. People are trying to do this because they say using the Netlify sub-domain gives them reach. This is the 3rd or 4th person asking this question. But, I suppose this thread is a duplicate of Redirecting facebook referral to the specific url
TL;DR: What you’re trying is not easily possible and I personally think, it’s not worth the efforts. But then I’m not a social media expert, so take that comment with a pinch of salt.
If even that doesn’t work for your case, I’m sorry there’s no other way I know of getting this working.
Also, when you say “it doesn’t work”, it’s not particularly helpful. If you actually mention what part doesn’t work or if you get some error or a special case where the code fails or something, then we can provide some debugging steps. But if you just say “it doesn’t work”, I’m sorry we can’t be of much assistance.
@djndr Have you verified that the _redirects file is at the top level of your site directory at Netlify? If it’s not in the correct place, none of your redirects will work.