Redirecting old forum URLs when the path contains the name of a Discourse resource

That is unfortunate.

What do they look like? What are the permalinks you added?

Is the forum live already or can you still run the import script? (Actually, you can make a Ruby script that you can run in Rails to add Permalinks like those that I describe.)

I think maybe you want to make your Permalinks something like /oldforum/{topic_id} and then to add some configuration to nginx to catch those /posts/t URLs and remap those to /oldforum/{topic_id}.

So (according to AI) you’d do a replace with pups (sometime soon you can add it to an outlet, but I don’t know when that’s going to happen) to add this to your discourse.conf nginx config:

# Place this inside your server {} block
location ~ ^/posts/t(?<topic_id>\d+)-.*$ {
    # Permanent redirect (301)
    return 301 /oldforum/$topic_id;
    
    # Alternatively, for temporary redirect (302), use:
    # return 302 /oldforum/$topic_id;
}

I’d test it by making those changes by hand inside the container and then work backward to add the changes to your app.yml.