【发布时间】:2015-08-15 01:07:15
【问题描述】:
我正在尝试通过 Apache 中的 .htaccess 设置创建一个安静的 url(它在 Yosemite 中默认安装。
这是我的设置
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L]
当我在浏览器中输入“http://localhost/~jokerham/API/user”时, 我收到一条错误消息
Not Found
The requested URL /Users/jokerham/Sites/API/index.php was not found on this server.
但是当我在终端中检查文件时,文件存在。
hamdong-gyun-ui-MacBook-Air:API jokerham$ pwd
/Users/jokerham/Sites/API
hamdong-gyun-ui-MacBook-Air:API jokerham$ ls
index.php
为什么我的 .htaccess 设置会出错?
【问题讨论】:
-
您是否在 apache 中启用了用户主目录?
-
我做到了。当我使用localhost/~jokerham/API/index.php 访问网址时,它工作正常。
-
user是一个真实的目录吗? -
用户不是真正的目录。
标签: macos apache .htaccess osx-yosemite