【发布时间】:2014-01-17 16:01:34
【问题描述】:
我想制作两个超薄应用,一个用于 api 调用,另一个用于网站用户。
我把我的主php文件放到'src'目录下,结构如下:
/
---.htaccess
---/src(here are files)
-----.htaccess
-----index.php(Slim)
-----/Controllers
-----/Views
-----/Models
-----/api
-------.htaccess
-------index.php(Slim)
---/public
-----/js
-----/css
-----/fonts
我想从这里制作我的网址:http://localhost/project/src/api/foo
致http://locahost/project/api/foo
不知道怎么写第一个.htaccess(root)
我尝试像这样重定向到子目录:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^src/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ src/ [QSA,L]
但它总是返回 404 Not found by Slim。我以为它确实重定向到了 subdir,但超薄路由器不会得到正确的 url,对吗?
其他的看起来是这样的:(我只是从 SlimFramework 复制文档)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA]
任何想法都会对我有很大帮助!谢谢!
【问题讨论】:
标签: php .htaccess mod-rewrite redirect slim