2014-02-12 68 views
0

我怎样才能让重写规则/ variableusername - 网址www.example.com/variableusernameURL重写规则

location /staticusername { 

      try_files $uri/ /admin/index.php?q=$uri&$args; 
    } 

如果我改变/ staticusername与我的一个用户名的所有工作,就像我需要。但是当我尝试用其他用户名登录时肯定不起作用。 那么如何将每个用户重写为/admin/index.php?q=$uri & $ args? 感谢您的任何意见

回答

0

如何:

location/{ 

    try_files $uri $uri/ /index.php; 
    index index.php index.html index.htm; 

    # rewriteRule: example.com/userName_0-9 
    rewrite ^/([A-Za-z0-9_]+)$ /admin/index.php?q=$1;  
}