Redirect webflow.io to krystlesvetlana.com

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

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 :slight_smile:

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 :webflow_heart:

Thanks for the tip… but what about when I make edits to the site and publish to the main domain?

1 Like

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

Great! Happy to help

2 Likes

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

Thanks for your help :raised_hands:

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!