Configuring redirects

Note: This option only works with PoppyGo hosting


Redirect rules are defined in a single JSON file

You probably want to redirect your old urls to your new PoppyGo webpages so that other sites linking to you won’t have broken links to you. Also you keep your authority score from google that you’ve built up over the years - if you had a site before - when you keep your old links working an pointing to beautiful fresh content.

Another need for redirects is when you want to avoid duplicate content on your www domain and your root domain. You should have them both point to the a single address.

Both type of redirects are configurable in PoppyGo.
Now, let’s get started.

Step 1: create _redirect.json in your static folder.

If the static folder doesn’t exist, go create it in the root of your site. Please make sure your filename starts with the underscore.

Step 2: Copy the boilerplate example

Here you find an example of redirects. You can copy this directly in your newly created file as a boilerplate.

{
  "rules":[
    {
        "from": "/project1",
        "to": "/project2",
        "code": 301
    },
    {
        "from": "/project3/*",
        "to": "/project2",
        "code": 301
    },
    {
        "from": "/project4/sub1/",
        "to": "/project2",
        "code": 301
    }
  ],
  "options":{
    "mainDomain": "yoursite.pogosite.com",
    "mainProtocol": "https",
    "redirectAllToMainDomain": true,
    "redirectCode": 301
  }
}

Step 3: Define your own redirects.

Let us walk through the json file. The file consist of redirects and options.

Redirects

Each redirect is defined with a “From”, “to” and “code” key-value pair.

    {
        "from": "/project1",
        "to": "/project2",
        "code": 301
    }
  • “from” is defined as a relative link path
  • “to” is also defined as a relative link path
  • “code” can be 301 (moved permanently), a 302 (moved temporarily), a (307 moved temporarily new style). Best for google is mostly 301.

Step 4: Define your options

At the lower end of the file, your see “options”. In the option section, you declare how the redirects behave.

“options”:{ “mainDomain”: “yoursite.pogosite.com”, “mainProtocol”: “https”, “redirectAllToMainDomain”: true, “redirectCode”: 301 }

  • Main domain: Enter the url of your poppygo hosted site. If you have a custom domain, fill that one there.
  • MainProtocol: this can be either http of https. Since PoppyGo sites are ssl encrypted by default, you would do best when you keep it https
  • redirectAllToMainDomain. true/false. If you choose true, the other domains like www will be redirected to your root domain.
  • redirectCode: this is the code which will be used for redirecting all to the maindomain. Normally 301 would be fine.

If you have more questions about using our redirects, please contact us.