使用 Apache,该指令DirectoryIndex index
以及DefaultType application/x-httpd-php
特定虚拟主机中的指令可以很好地从索引文件中排除文件扩展名,而无需重写。如何在 Nginx 中复制它?到目前为止,我所能找到的只是正则表达式重写解决方案。
问问题
430 次
1 回答
0
.conf 文件看起来像这样:
server {
server_name example.com;
# Set the docroot directly in the server
root /var/www;
# Allow index.php or index.html as directory index files
index index;
# See if a file or directory was requested first. If not, try the request as a php file.
location / {
try_files $uri $uri/;
}
}
该行try_files $uri
应该在后端尝试没有扩展名的文件
于 2012-06-17T23:10:54.510 回答