Error trying to upload redirects.yaml

I’m wondering why the error message I get refers to fetching, when in this case I’m trying to upload. Maybe the error could be more descriptive?

Have you successfully uploaded the file before? You can use an online syntax checker to confirm that it contains valid YAML, and ghost doctor to check permissions.

Okay, I found a syntax checker and found out that I can’t use any tabs, so I removed them. Then I successfully uploaded the file. Then I tried to check to make sure one old URL goes to the new one, but get a 404 error. Is there anything I need to do to activate this yaml file other than uploading it?

Once you upload it through the labs link (in your previous image), it’s live. I suspect you’ve got a problem with matching. If you want to post it and explain what it’s supposed to do, we can troubleshoot it together! :)

Okay, there are a ton of redirects, but they all follow this pattern:


/permanent-redirect-from: /permanent-redirect-to
/permanent-redirect-from-2: /permanent-redirect-to-2

/articles/koyle/238-a-prophetic-poem: /prophetic-poems/
/articles/koyle/236-a-list-of-prophecies: /bishop-koyle-signposts/

So I tested it by going to which should have redirected to Prophetic Poems but it went to 404

I’m not sure what else to do, because I followed the example at the beginning of the YAML file.

Thank you!

Two spaces. You need two spaces before each line except the 301: and 302

1 Like

Like this? If so, how come this isn’t mentioned in the documentation?


/permanent-redirect-from: /permanent-redirect-to

/permanent-redirect-from-2: /permanent-redirect-to-2


/articles/koyle/238-a-prophetic-poem: /prophetic-poems/

/articles/koyle/236-a-list-of-prophecies: /bishop-koyle-signposts/

Maybe my phone is mangling things, but no, I don’t mean a blank line but a two space indent at the start of each line.

Perfect, it’s working now. I’m used to using my own amount of white space when working in PHP files, so I find it odd that this YAML file requires exactly two spaces as an indentation.

Thanks again!

One other issue. How do I get an old URL to redirect to just the homepage? Both of these options do not work:

/newsfeeds: /

Try specifying the full irl including https:?

Okay, I got that one working, but this one is not:

/website-links/{*}: /links/

So this URL should simply redirect to /links/ which it doesn’t, as it produces a 404 error.

What am I missing? I uploaded the modified redirects.yaml file to the Ghost server.

I think your YAML should look more like this (I also think you need to escape some characters.)

  ^\/website-links\/([a-z0-9-]+)\/$: /links/$1

This would match anything after website-links (the $1) and place this after /links. Note the two leading spaces after 301:; this is essential. ([a-z0-9-]+) matches any letter, number and “-”.

Okay, I finally got it working using:

^\/website-links\/.*\/?: /links/

Now I’m stuck on this one, which chatGPT said should work:

/index.php: /

This is to accommodate old links out there that are referencing the old site, which used Joomla, and had an index.php page. When going to index.php the page loads and just shows, “Forbidden”. So I’m guessing the Ghost platform is intervening here. How do I work around this?