【发布时间】:2014-08-19 23:32:57
【问题描述】:
我正在尝试模拟多视图,但我遇到了 try_files 的问题。一切正常,但我想重写所有未管理到 /index.php 的 url(但没有 404):
location ~ ^(/.+)/ {
try_files $uri $uri/ $1.php?$args @extensionless-php /index.php;
}
location @extensionless-php {
rewrite ^(.*)/ $1.php;
}
所有 url 都被重写为 /index.php。如果我在第一个位置的末尾删除 /index.php,除了非托管 url(我想重写为索引)之外,一切都很好。任何想法?谢谢
【问题讨论】:
标签: nginx rewrite multiviews