Problem configuring Redirect

I am trying to setup a redirect.

I downloaded the redirect.json. It took me a while to figure out that the documentation was for a redirect.yaml and not the default .json file.

Now that I got that figured out I created a .yaml file with a single redirect

301:
/blog/privacy: /blog/privacypolicy

and it does not work.

Hey max1e6! Welcome to Ghost!

.yaml is really fussy about spacing. Do you have the two spaces before /blog… ? In the future, if you use the </> button in the editor menu, your code and markup will show up in more readable form. :)

Did you upload the yaml file with a .yaml extension? (Not .json.) I’m not sure if Ghost cares, but it might.

And could you say what you mean by ā€˜does not work’? Endless redirect loop, or no redirect at all?

Thanks for the reply!

Yes, I did use the .yaml extension.

Yes, Ghost does care. If you use a .json extension I appears to parse it like a .json file same same for .yaml.

I did double check for two spaces before /blog.

Does not work…no redirect at all.

Let me check one more thing.

You uploaded the redirects.yaml to Ghost using Settings > Labs, right? You didn’t just put it into the theme or try to find a copy in the actual Ghost install and edit it, right?

If you haven’t already done so, restarting Ghost (if self-hosted) is worth trying.

(Sorry for asking silly questions, but I get lucky and identify the problem with the silly question often enough that I keep doing it.)

Yep. Uploaded in Labs->Redirects.

There is no such thing as a silly question.

2 Likes

Just restarted. Still does not redirect. 404.

I even upgrade ghost to the latest version (just now). Still 404.

Are you able to share your site where this is happening? It might help to diagnose. I tested this redirect on my own site and it worked for me, so I think something else might be going on.

www.williammax.com/blog/privacy

Thanks Ryan.

I think I might know what is going on and I have not figured out a solution.

I am self hosting ghost on docker using Traefik as a reverse proxy.

The site is IT Trends & DevOps by William Max & Co., but the docker container thinks it is https://www.williammax.com.

I am using Traefiks ā€œstrippprefixā€ to strip the /blog from the URL before sending to the docker container.

According to one article I found on the Internets…the stripprefix occurs before the redirect. I tried modifying the redirect to /privacy → /privacypolicy, but this did not work either.