Streaming live at 10am (PST)

Redirect webflow.io to krystlesvetlana.com

#1

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 > https://www.krystlesvetlana.com/mission-san-francisco

Is there a way I can set a redirect from the webflow one to my main one?

K

1 Like
#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 :slight_smile:

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

#4

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

1 Like
#5

If your site is not showcased you can disable the Webflow subdomain and publish only to the main domain.

#6

Oh gotcha! Ok great - it’s working now! Thanks

1 Like
#7

Great! Happy to help

2 Likes
#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>
1 Like
#9

Thanks for your help :raised_hands:

#10

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!