建议增加帖子短链接

建议增加帖子短链接,例如:

301 forums.winterco.org/t/404 => https://forums.winterco.org/viewtopic.php?t=404

如果不会写 nginx.conf 我可以帮忙。

PHPBB内部没有Rewrite就改个外部的链接我觉得好像没什么意思啊。

MOTD放长链接观感太差了…

看看其他人觉得如何。

server {
    listen       [::]:443 ssl http2;
    listen       443 ssl http2;
    server_name  forums.winterco.org;
    root         /var/www/html/phpBB3/;

    add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains;';
    
    location ^~ /.well-known/acme-challenge/ {
        alias /var/www/.well-known/acme-challenge/;
        try_files $uri = 404;
    }

        location / {
            # phpBB uses index.htm
            index index.php index.html index.htm;
            try_files $uri $uri/ @rewriteapp;
        }

        location @rewriteapp {
            rewrite ^(.*)$ /app.php/$1 last;
        }

        # Deny access to internal phpbb files.
        location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
            deny all;
            # deny was ignored before 0.8.40 for connections over IPv6.
            # Use internal directive to prohibit access on older versions.
            internal;
        }

        # Pass the php scripts to fastcgi server specified in upstream declaration.
        location ~ \.php(/|$) {
            # Unmodified fastcgi_params from nginx distribution.
            include fastcgi_params;
            # Necessary for php.
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT $realpath_root;
            # try_files $uri $uri/ /app.php$is_args$args;
            fastcgi_pass 127.0.0.1:9000;
        }

        # Correctly pass scripts for installer
        location /install/ {
            # phpBB uses index.htm
            try_files $uri $uri/ @rewrite_installapp;

            # Pass the php scripts to fastcgi server specified in upstream declaration.
            location ~ \.php(/|$) {
                # Unmodified fastcgi_params from nginx distribution.
                include fastcgi_params;
                # Necessary for php.
                fastcgi_split_path_info ^(.+\.php)(/.*)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
                fastcgi_param DOCUMENT_ROOT $realpath_root;
                try_files $uri $uri/ /install/app.php$is_args$args;
                fastcgi_pass 127.0.0.1:9000;
            }
        }

        location @rewrite_installapp {
            rewrite ^(.*)$ /install/app.php/$1 last;
        }

        # Deny access to version control system directories.
        location ~ /\.svn|/\.git {
            deny all;
            internal;
        }
}

这是现在的Nginx配置,加上上面那个301也不麻烦,但是不怎么好维护了如果后面还有别的需求。

维护不麻烦啦、我的nginx配置都是几十行的=、=

    location ^~ /t/ {
        rewrite ^/t/(.*)$ /viewtopic.php?t=$1 permanent;
    }