【发布时间】:2012-03-14 16:21:37
【问题描述】:
当我已经在 webroot 上有一个重写规则以删除“index.php”时,关于在子目录上重写 mod 的快速问题
我的 .htaccess 看起来像这样:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
我有一个 API 目录 (/webroot/api/index.php),我想要一个 RESTful API (Restler) 来为应用程序提供请求 - 所以我的问题是......
要发出 RESTful 请求,我需要使用以下 URL 格式:
/webroot/api/index.php/user/get/ (to get all the users)
我想要实现的是以下形式:
/webroot/api/user/get/ (return a list of users)
仍然保留主网站的基本重写规则
/webroot/members/ (display a list of users in the main applications)
非常感谢, 贾斯汀
【问题讨论】:
标签: mod-rewrite apache