Redirect any 404 to my home page

I just redesigned my website from a php hosted on hostmonster to wix. Problem is that many link on the internet are still pointing to URL (pages) from my old website. Since they don’t exist anymore I want to redirect any 404 to my home page. I can’t find an easy way of doing this simple task. Any pointers appreciated. Thanks

You probably need to look into the wix-router functionality. If you are familiar with laravel or similar routing techniques in PHP then you will probably be able to figure out how to proxy the php routing using wix-routing.

Note: wix-routing executes on the server in the same way that php routing does and does so from a single routers.js file which you can probably simplify using javascript imports.

Check out this link

Cheers

Hi there! Did you ever figure out how to redirect all 404s to your home page?
I need to do the same thing since some of my old Google search results link to specific .html files that does not exist on my new Wix site.
I have looked into the Wix Router code by I cannot figure out how to redirect 404s.

You can have your own individual 404 page that you can customize how you want it.
https://support.wix.com/en/article/customizing-your-404-error-page

Otherwise, just do the example above and leave the page blank and simply add simple code into the page onReady function so that the page is redirected straight to your own home page.

As the page itself is blank, it should not be noticeable to the user and therefore should look like it is going straight back to your home.

Something like this…

import wixLocation from 'wix-location';

$w.onReady( () => {
wixLocation.to("/yourhomepage");
})

If you have a page that no longer exists and is returning a 404 error, or you have changed the URL name of a previously published page, you can create a 301 redirect to your home page or to another page in the site.

This works - add velo code

import wixLocation from ‘wix-location’;

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

working example on my site: https://declandp.info/example