【发布时间】:2011-06-02 09:19:08
【问题描述】:
我正在尝试设置和学习 PHP 的 Fat Free 框架。 http://fatfree.sourceforge.net/
它的设置相当简单,我正在使用 MAMP 在我的机器上运行它。
我能够让“hello world”示例运行正常:
require_once 'path/to/F3.php';
F3::route('GET /','home');
function home() {
echo 'Hello, world!';
}
F3::run();
但是当我尝试添加第二部分时,它有两条路线:
require_once 'F3/F3.php';
F3::route('GET /','home');
function home() {
echo 'Hello, world!';
}
F3::route('GET /about','about');
function about()
{
echo 'About Us.';
}
F3::run();
如果我尝试第二个 URL:/about,则会收到 404 错误
不确定为什么 mod_rewrite 命令之一会起作用,而另一个则不起作用。
以下是我的.htaccess 文件:
# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
# Disable ETags
Header Unset ETag
FileETag none
# Default expires header if none specified (stay in browser cache for 7 days)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A604800
</IfModule>
【问题讨论】:
-
@DC 不走运,我不知道该去哪里修复它。
-
新的无脂肪网站:bcosca.github.com/fatfree
标签: php .htaccess mod-rewrite fat-free-framework