【发布时间】:2014-03-21 14:27:03
【问题描述】:
我希望我的 nginx 使显示所有 url 的内容都干净。
- http://www.mydomain.com/indexhtml.html 为 http://www.mydomain.com/indexhtml
- http://www.mydomain.com/indexphp.php 为 http://www.mydomain.com/indexphp
通过一些研究,我制作了第一个案例。通过以下配置完成:
location / {
root html;
index index.html index.htm index.php;
try_files $uri.html $uri/ =404;
}
它适用于 indexhtml.html 显示为 indexhtml,但 .php 没有任何反应。如果我将 $uri.html 更改为 $uri.php,它既不适用于 .html,也不适用于 .php。我试图在 php 位置放置类似的东西,但没有任何成功。
有什么建议吗?
【问题讨论】:
-
等一下,您要添加不带点的扩展名吗?
-
不,我根本不需要扩展。那
s only for example to understand, that Im 不是怪人,谁s having both index.php and index.html files on my server. However, its 已经解决了。