没有扩展名的 Apache 映射文件如何?

Den*_*tor 9 url apache-http-server filesystems rewrite php

我的本地开发设置将http://mydomain.dev/testhtmlpage映射到 testhtmlpage.html 和http://mydomain.dev/testphppage到 testphppage.php。浏览器停留在最初输入的 URL 上。问题是我最初没有配置我的机器,虽然我现在对它有一个很好的处理,但我找不到定义这种行为的地方。

我检查了我的 httpd.conf 和两个包含的区域,但没有运气。

我的 httpd.conf: http : //denishoctor.me/myhttpdconf.xml(查看源代码)

在包含 /private/etc/apache2/other/*.conf 中:

<IfModule php5_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
Run Code Online (Sandbox Code Playgroud)

有人有任何想法吗?

Joh*_*n T 10

这可能是由多种原因造成的,从重写规则到内容协商。根据您的 判断httpd.conf,在这种特殊情况下的原因是因为您打开了 Multiviews。

摘自您的配置:

选项索引 FollowSymLinks MultiViews

将其更改为此并重新启动Apache:

期权索引 FollowSymLinks