【发布时间】:2011-01-05 14:17:38
【问题描述】:
我正在我的 Mac 上为 API 本地开发一个 PHP RESTful 服务器。
我已成功启用 mod_rewrite 并允许站点目录 (~/Sites/api) 覆盖。
在 ~/Sites/api 中是 .htaccess 文件和 index.php。我想将所有对http://localhost/~myusername/api/* 的请求重写为index.php。我需要保留查询参数,仅此而已。
我在 .htaccess 文件中尝试了以下内容:
Options +FollowSymLinks
RewriteEngine On
RewriteRule (.*) index.php [QSA,NC,L]
这会产生 500:Internal Server Error。
注释掉 FollowSymLinks 行会产生 403:Forbidden 错误。
我可以很好地访问 index.php 而无需重写。
您能提供的任何帮助将不胜感激。我现在想哭。
谢谢, 罗斯
【问题讨论】:
标签: apache rest mod-rewrite url-rewriting