且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Nginx:404 错误时返回 301 重定向

更新时间:2023-10-21 15:41:34

这是我使用 webfaction 工作的最终解决方案.

Here is the final solution that I got to work using webfaction.

server {
        listen             12440;
        root       /some/path/here/nginx/html/noahc/;
        server_name    www.domain.net, domain.net;
        port_in_redirect off;

        location /{
            error_page 404 =  @foobar;
        }

        location @foobar {
            rewrite  .*  / permanent;
        }    
 }