Just a quick help with redirect json syntax and somehow this is elluding me (the variables part, as I am not a developer):
I want to redirect from my former blog all articles from:
to the new Ghost format of
I’ve tried this:
But it is not working…
Later edit: made it to work, but again manually:
As if I were to replace “others” with .* it would go into a redirect loop.
doesn’t seem to work (:boggled:) as it seems only the first rule in the list works and none of the following ones.
Later edit: adding a / (i.e. ^/personal) seems to have solved the issue.
I’ve done the categories manually, i.e. from
but this could have been done with a simple regex as well.
The examples in the docs (https://docs.ghost.org/v1/docs/redirects) don’t help much as they don’t give the actual result of the redirect. It would help to add in the long list of examples also what they actually do.
Redirects from /post/post-name to /post-name/.
Replying to myself with the actual working redirects maybe it helps other people as well:
If you migrated your blog from WordPress to Ghost and wanted to fix the URL’s (assuming your WP permalinks were domain.com/category/), then you need to do the following:
This will redirect from domain.com/others/post-name/ to domain.com/post-name/ (the postname being a regex variable made out of letters & numbers that is afterwards called with $1).
If you want to redirect the category URL’s (i.e. domain.com/category/category-name/) if they were somehow indexed by Google, you need to do the following:
This will redirect domain.com/others/ to domain.com/tag/others/.
I also had to redirect domain.com/category/others/ so I added this:
I hope this helps .
Hey @dsecareanu I take it you managed to get this figured out
Not sure if you have seen this, but our docs (which for sure need an overhaul) have a “suggest edits” button. If you’d like, you can submit suggestions for what information you think is missing from the page.
It’s a hard thing to document cos it depends on how well people know regex, but there’s really not any other way to do redirects!
@Hannah, I’ve submitted some edits , but since I’m not sure what some of the examples describe I’ve left them under “other examples” category. I also tried to restructure de page content a little bit to make it more logical in terms of how it flows and to provide some little extra bits of info that I had to figure out on my own (not being familiar with .json file formats).
Check it out and let me know if it makes sense .
I’ve merged your suggestions and corrected/extended the redirect page a little here and there. Thanks for your time!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.