Redirect JSON evaluating catch all rule even though a specific rules exists for a URL


#1

Hey there

I migrated a site from MovableType to Ghost in November and have an issue with the old indexed search results. I’ve created a redirect.json file which is set up as follows.

[
    {
        "from":"https://www.jnd.org/dn.mss/in_appreciation_of_j.html",
        "to":"/in_appreciation_of_jef_raskin/",
        "permanent":true
    },
    {
        "from": "https://www.jnd.org/dn.mss/simplicity_is_highly.html",
        "to":"/simplicity_is_highly_overrated/",
        "permanent": true
    },
    {
        "from": "https://www.jnd.org/dn.mss/apples_products_are.html",
        "to":"/apples_products_are_getting_harder_to_use_because_they_ignore_principles_of_design/",
        "permanent": true
    },
    {
        "from": "https://www.jnd.org/dn.mss/words_matter_talk_ab.html",
        "to":"/words_matter_talk_about_people_not_customers_not_consumers_not_users/",
        "permanent": true
    },
    {
        "from": "https://www.jnd.org/dn.mss/the_truth_about_goog.html",
        "to":"/the_truth_about_googles_so-called_simplicity/",
        "permanent": true
    },
    {
        "from":"/dn\\.mss/(.*?)\\.html",
        "to":"/$1/",
        "permanent":true
    }    
]

The issue I have is that when I hit one the hard-coded URLs such as https://www.jnd.org/dn.mss/the_truth_about_goog.html it still redirects to our 404 page because it evaluates the ‘catch-all’ rule and cannot match a URL.

My expectation was that it would match the first rule and then exit the redirect code.

Has anyone come across this before? Any useful solutions to this problem?


#2

The redirects feature does not detect or redirect external domains. The feature was added to redirect Ghost url paths.


#3

Hey Kate

I didn’t really understand that at first, but thanks to Sarah in support I now know what you mean.

The issue was that I had full URLs in the ‘from’ attribute in the JSON. Whereas I should have had the URL without the domain prefix, which works.

Example.

[
    {
        "from":"/dn.mss/in_appreciation_of_j.html",
        "to":"/in_appreciation_of_jef_raskin/",
        "permanent":true
    },
    {
        "from": "/dn.mss/simplicity_is_highly.html",
        "to":"/simplicity_is_highly_overrated/",
        "permanent": true
    },
    {
        "from": "/dn.mss/apples_products_are.html",
        "to":"/apples_products_are_getting_harder_to_use_because_they_ignore_principles_of_design/",
        "permanent": true
    },
    {
        "from": "dn.mss/words_matter_talk_ab.html",
        "to":"/words_matter_talk_about_people_not_customers_not_consumers_not_users/",
        "permanent": true
    },
    {
        "from": "dn.mss/the_truth_about_goog.html",
        "to":"/the_truth_about_googles_so-called_simplicity/",
        "permanent": true
    },
    {
        "from":"/dn\\.mss/(.*?)\\.html",
        "to":"/$1/",
        "permanent":true
    }
]

Thanks for your’s and Sarah’s help I can finally start repairing the malformed google search results.

Matt


#4

Glad you figured it out with the help of @Sarah :innocent:


#5

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.