NGINX位置通配符
我们在NGINX位置通配符,nginx,Nginx,我们在public\u html下有多个子文件夹,基本上就是这样 /2014年 /2015年 我可以这样做nginx conf.d位置通配符吗 location /year2014 { rewrite ^/year2014 /(/.*)$ /app/webroot$1 break; try_files $uri $uri/ /year2014 /app/webroot/index.php?$args; } 我是否可以将location/year2014作为通配符变
public\u html
下有多个子文件夹,基本上就是这样
- /2014年
- /2015年
location /year2014 {
rewrite ^/year2014 /(/.*)$ /app/webroot$1 break;
try_files $uri $uri/ /year2014 /app/webroot/index.php?$args;
}
我是否可以将location/year2014作为通配符变量,这意味着它可以是任何东西,因为所有这些都共享相同的设置?这个如何(未测试)?请注意root的位置更改和双重写规则,以覆盖末尾的斜杠
location / {
rewrite "^/year(.*)" /app/webroot/year$1/;
rewrite "^/year(.*)/" /app/webroot/year$1/;
...
当你说“有多个子文件夹”时,你是指
public\u html
中的物理目录,还是仅仅是你的URI结构?是的,物理目录