Redirect a wix website page to external URL

29.7k views Asked by At

I'm trying to create a wix page which will redirect all users that link to it to an external URL.

I tried adding the code below as a "html wix app" but it didn't worked.

<meta http-equiv="refresh" content="0; URL=http://www.my-new-url.com">
5

There are 5 answers

6
Prince On

Maybe try:

<meta http-equiv="refresh" content="0; URL=http://www.my-new-url.com/" />

You left out a " at the end. I hope this helps!

Try:

<script type="text/javascript">
    window.location.href = "http://www.my-new-url.com"
</script>

Try this:

<html>
<meta http-equiv="refresh" content="0; URL=http://www.my-new-url.com/" />
</html>
0
saji89 On

You can use wix-location from Wix Code, for this. An example of using it to navigate to an external URL is:

import wixLocation from 'wix-location';

// ...

wixLocation.to("http://www.my-new-url.com");
3
Stephen Saucier On

When you insert an HTML "module" into Wix, it is actually inserted into an iframe on the page rather than the page itself.

Fortunately, the iframe is hosted at the same domain, so you don't have to deal with cross-domain issues. Therefore, this code, when inserted into an HTML module on a Wix page, successfully redirects the parent:

<script type="text/javascript">
    window.parent.location.href = "http://www.my-new-url.com"
</script>
6
Anke On

I had a similar use case and solved it using the wix-location module:

import wixLocation from 'wix-location'; 

$w.onReady(function () {
     wixLocation.to("http://www.my-new-url.com");
}) 
0
lemon On

The above code:

<script type="text/javascript">
    window.parent.location.href = "http://www.my-new-url.com"
</script>

works on my wix site: https://www.lemon-sin.com.au/ redirects to director's linkedin account