Hi
I noticed some people sharing my ‘webflow URL’ instead of my published official URL:
Using this: https://krystlesvetlana.webflow.io/mission-san-francisco INSTEAD of this > Mission San Francisco
Is there a way I can set a redirect from the webflow one to my main one?
K
2 Likes
Tobi_Huber
(Tobi Huber)
January 15, 2019, 9:55am
2
You could put a script that strips the domain and replaces it with your custom domain, but only does so if the current URL contains “webflow.io ”. I’m sure it can be done. I’m not a developer though
PeterDimitrov
(Webflow Expert Partner)
January 15, 2019, 10:10am
3
Hello @Krystle_Svetlana
Here’s something that works
<script>
window.location.replace('https://www.yourdomain.com')
</script>
I’m not a code master too, but maybe the code is a good solution.
You need to open the designer > place the code inside of the pages custom code area (before closing body tag) > publish only to the Webflow subdomain.
Here’s a screen record > https://www.useloom.com/share/bde9cd9787064d92a2ef041ffd31d8c8
You can place the code in every page and make the page redirect to the main domain page.
Home page Webflow subdomain
<script>
window.location.replace('https://www.yourdomain.com/homepage')
</script>
About page Webflow subdomain
<script>
window.location.replace('https://www.yourdomain.com/aboutpage')
</script>
You get the point.
If you need more help feel free to reach out.
Piter
Thanks for the tip… but what about when I make edits to the site and publish to the main domain?
1 Like
PeterDimitrov
(Webflow Expert Partner)
January 15, 2019, 10:17am
5
If your site is not showcased you can disable the Webflow subdomain and publish only to the main domain.
Oh gotcha! Ok great - it’s working now! Thanks
1 Like
samliew
(webflowexpert.com)
January 17, 2019, 12:01pm
8
This is bad advice. If it is accidentally published to the live site in future, your visitors will get a redirect loop and won’t see anything at all.
Use this instead.
<script>
if(location.hostname.includes("webflow.io")) location.replace("https://www.yourdomain.com");
</script>
2 Likes
Yeh I noticed that which is why I just took my website off showcase instead.
Thanks so much for sharing that Sam! I will implement that!