All Collections
Learn how to implement 301 redirects for missing pages
Learn how to implement 301 redirects for missing pages
Naoko Shimogaki avatar
Written by Naoko Shimogaki
Updated this week

Redirect a missing page to the home page

This option is great for you if you used a custom domain somewhere else and:

  • You connected a custom domain to the Durable website, and it had a website prior to the Durable one

  • You have pages that no longer exist

  • You would like to redirect them to the new home page on your Durable site

Otherwise, you do not need to perform the steps below.

If you would like to create a redirect within your website, you can add the code snippets below:

  1. Go to Website > Settings.

  2. Scroll down to the Custom Code section and paste the applicable codes into the header section.


    Single page

    var currentPath = window.location.pathname;

    var pathToRedirect = "/page1";

    if (currentPath.includes(pathToRedirect)) {
    window.location.href = "/";

    Multiple page

    const currentPath = window.location.pathname;

    const oldPaths = ["/old-path1", "/old-path2", "/old-path3"];

    if (oldPaths.some(path => currentPath.includes(path))) {
    // Redirect to the homepage
    window.location.href = "/";

    Multiple sending to different pages

    const currentPath = window.location.pathname;

    const redirects = [
    { oldPath: '/old-path1', newPath: '/' },
    { oldPath: '/old-path2', newPath: '/services' },
    { oldPath: '/old-path3', newPath: '/' }

    redirects.forEach(({oldPath, newPath}) => {
    if(currentPath.includes(oldPath)) {
    window.location.href = newPath;

  3. Click Save.

Reminder: This is a suggested code; however, the Durable team is unable to validate the code on an individual basis. Please proceed with caution when saving the code.

Did this answer your question?