Redirect from wix site to a completely different wix site

Hi, I have 2 wix sites with 2 premium accounts for 2 different businesses. One site was generated to remove the pages from the first site and have it’s own autonomous site. I want to redirect the old pages from the first site the new pages on the new site (they are basically copies). How do I do this? I was told java script but I’m not sure I am inputting it right. Do I use an HTML code app or edit the page code?

This is what I found, with my appropriate sites coded:

import wixWindow from ‘wix-window’;
$w.onReady(function() {if (wixWindow.referrer !== " https://www.t utoringwithandria.com/ycdpmedia") {wixWindow.parent.location.href = " https://w ww.steme.org/newsletter";}}) ;

Also found this one:

import wixLocation from ‘wix-location’;

$w.onReady(function () {
wixLocation.to(“https://www.steme.org”);
})

Hi Andria!

No need for the wixWindow API in this case, but the WixLocation is exactly what you’re looking for!
Your code looks fine too. Just take into consideration that if you put it in the onReady function it will automatically be directed to the next page every time someone will try to access it.

Best of Luck!
Doron. :slight_smile:

Hi Doron, thanks for your response. Where do I input this? Sorry the last time I coded it was C++ and it was 15 years ago.

I did the inframe app and got it to work but I don’t want an inframe. I want automatic redirect for that page altogether and it to be done every time, like you mentioned.

This might be a bite late, but I’m posting this in case somebody else wants to redirect a page automatically to a URL outside of their wix site.

You don’t need to put it in an inframe.

(1) Open Wix Website Editor
(2) In the top bar go to CODE, select TURN ON DEVELOPER TOOLS
(3) Once it’s turned on, click the bar at the very bottom of the editor it should say something like “____ PAGE CODE”

There should be a bunch of lines there, with tabs on the left hand side that says “page” and “site”
Make sure you’re on the “page” tab…

(4) Then on line one put the code:

import wixLocation from ‘wix-location’;

$w.onReady( function () {
wixLocation.to(“https://careersurge.as.me/”);
})

(5) Publish the page and it should work!

THANK YOU! I have been muddling through this for days and could not get it to work. I must have had a space or character where it didn’t belong. You just saved my bacon. :slight_smile: