我在Mac OS X 10.9上创建了一个WebApp。如果我只是去像index.html这样的东西它工作正常,所以我知道apache配置有效。现在我试图让重写规则为Restler工作并遇到问题。我的httpd.conf文件如下所示:
Alias "/dts" "/Library/Server/Web/Data/WebApps/dts"
<Directory "/Library/Server/Web/Data/WebApps/dts">
AllowOverride All
Options Indexes -MultiViews FollowSymLinks
</Directory>
现在我希望像https://myserver.com/dts/api/foo这样的路径重定向到api目录中的index.php文件,所以我在.id子目录中放了一个.htaccess文件:
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Library/Server/Web/Data/WebApps/dts/api
RewriteRule ^$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
php_flag display_errors On
</IfModule>
我的重写日志的最后一行显示正确的路径:
(1) pass through /Library/Server/Web/Data/WebApps/dts/api/index.php
但是浏览器返回的是:
The requested URL /Library/Server/Web/Data/WebApps/dts/api/index.php was not found on this server.
如果我做了那条路的ls -l那绝对存在。我做错了什么?