Substack redirect - comments pages

Hello there,

I’m working on migrating my Substack newsletter with a custom domain to Ghost.

I understand that there needs to be a redirect implemented for post URLs that also ensures that post previews continue to work in the Ghost editor.

That rule has been provided by Ghost as such:

    \/p\/(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})(.*): /$1


My question has to do with the comments pages.

Substack has made it so that each post with comments gets its own page at “…/p/post-slug/comments”. With the above rule, these pages throw up 404 pages.

Is there a way to amend this rule so that it would redirect “/p/post-slug/comments” to “/post-slug” in Ghost, without breaking Ghost editor previews?

Thanks in advance for any help on this topic!

Yep, here ya go:

^\/p\/(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})([0-9a-z_\-]+)\/comments\/$: /$1

Assuming new posts are living at /post-slug. Adjust what’s after the colon if not.

p.s. is a great way to work this stuff out. :)

1 Like