将 XenForo 论坛迁移到 Discourse

我尝试重写以使 xenforo 的链接不再无法使用,结果如下。

为了编写永久重写,我使用了以下帮助:Set up Let’s Encrypt with multiple domains / redirects 以及 @pfaffman 的帮助

hooks:

...

  after_ssl:
    - replace:
        filename: "/etc/nginx/conf.d/discourse.conf"
        from: /#\s*auth_basic_user_file\s*.*;/
        to: |
          # auth_basic_user_file /etc/nginx/htpasswd;

          location /threads/ {
            rewrite ^/threads/(.*)\.\d+/?$ /t/$1 permanent;
          }