在 Apache 应用的目录中有 .htaccess 文件来进行重定向,目的是实现省略扩展名 .php 来访问相应的 php 文件,例如用 url
http://localhost/unmi/forgotPassword 来访问 http://localhost/unmi/forgotPassword.php
.htaccess 文件的内容是:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
结果访问 http://localhost/unmi/forgotPassword 时出现错误:
Not Found
The requested URL /data/unmi/forgotPassword.php was not found on this server.
实际上文件 /data/unmi/forgotPassword.php 是存在的。这就奇怪了,怀疑过是文件权限的问题(Mac 平台),改成 755 也不行。也经为是 AllowOverride 的问题,可它的值我设置成了 All 啊,又不是 None,应该不是症结所在。
费了一番功夫也明白了我是配置了别名来访问应用的,在 Apache httpd.conf 中是这样定义的别名: 阅读全文 >>