Hi,
I’m trying to redirect several pages on my website to external resources.
I found the way to redirect using a 301/302 within the website, but I need to use an external URL.
How do I do that?
Thanks!
Hi,
I’m trying to redirect several pages on my website to external resources.
I found the way to redirect using a 301/302 within the website, but I need to use an external URL.
How do I do that?
Thanks!
Hi,
You don’t say how you are doing the 301/302 redirection, but you have a couple of options:
Use wix-router which is a comprehensive and robust API for handling page requests. You can learn About Routers from the documentation.
Have fun,
Yisrael
hello.
i have this problem.
i need to redirect to enother domain once a non mobile client (pone or tablet) is requesting the wix site.
is that possible now
reason for that is that our mobile version is wix and desktop-pc version is on other domain all together.
thank you.
you may check our current solution for this (idiotic) problem if you click from your desktop nicolesamuel.wixsite.com and then do the same from your phone.
thank you
oded samuel.
Hello, I’m trying to redirect mobile users to a specific page when they open homepage of my website.
I have inserted following code to my site:
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
$w.onReady(funtion () {
if(wixWindow.formFactor === "Mobile"){
wixLocation.to.to('https://www.mywebsiteurl.com/mobile-page-name'https://www.mywebsiteurl.com/mobile-page-name');
}
});
Redirect works, but it works only after first loading the original homepage. I would like users to be directed to my mobile page immediately after they click on my site url without loading the homepage first.
Thank you.
I am trying to use the redirect code and failing utterly. I am using the code from the documentation:
import wixLocation from ‘wix-location’;
// …
wixLocation.to(“https://mylink.com”);
This is used in an HTML iframe just like my Facebook pixel. However, it will not redirect. What am I doing wrong?
Tried this as well to no avail:
import wixLocation from ‘wix-location’;
// …
$w.onReady(funtion () {
wixLocation.to(“Joinnow.Live Webinars”);
});
You can’t use wixLocation.to() in an HtmlComponent (iFrame). Corvid code does not work in an HtmlComponent.
What isn’t working in your second example with theredirect in the onReady() function?
@yisrael-wix
#1 was the problem. I did not understand that but eventually figured it out on my own and figured out how to access the Page code. Took me a couple hours, but once I discovered that the HTML iframe is sandboxed and there was a place for Page code, it was downhill from there.
Alright, someone help me out here. I am using the location/to fn:
import wixLocation from ‘online-registration’;
// […](…
wixLocation.to(“https://n317.fmphost.com/fmi/webd#TISL”)
[wixLocation.to(“https://n317.fmphost.com/fmi/webd#TISL”);](…
wixLocation.to(“https://n317.fmphost.com/fmi/webd#TISL”)
This doesn’t work for me. Are we supposed to define ‘location’ somewhere or are we supposed to add new .js to the backend?
What isn’t working? What happens? What are you trying to do?
@yisrael-wix I want to redirect from a page with the slug “online-registration” to the link https://n317.fmphost.com/fmi/webd#TISL . Wix allows menu items to link to external pages, but not a redirect from a page with a certain slug to another link.
@jordan74845 I don’t understand what you are trying to do.
Note that in the original code that you posted, wixLocation(…) should be in the page’s onReady() function.