Nginx子域try_files(带request_uri)

时间:2014-06-30 05:57:39

标签: nginx rewrite subdomain

[现状]

sub.domain.com => domain.com/users/?user_name=sub [确定]

如何更改?

sub.domain.com/?page=about => domain.com/users/?user_name&page=about [失败]

server {
    server_name ~(<subdomain>[^\.]*).domain.com;
    root /var/www;

    location / {
            try_files $uri $uri/users/index.php?user_name=$subdomain&$request_uri;
    }

    location ~ \.php$ {
            ...
    }
}

请帮助..

0 个答案:

没有答案