我正在使用Apache 2.2和PHP 5.3。我正在尝试使用Fatfree框架进行路由。我的index.php文件看起来像:在Apache 2.2上使用FatFree和PHP5.3时无法呈现简单页面
<?php
require_once 'f3/lib/base.php';
F3::route('GET /','home');
function home() {
echo F3::render('templates/index.html');
}
F3::route('GET /@pagenum','mainlist');
function mainlist() {
F3::set('pagenum', @pagenum);
echo Template::serve('templates/index.html');
}
F3::run();
?>
如果我去的“http://本地主机:8080 /”它正确地呈现文件模板/ index.html的,这意味着PHP和Fatfree都在工作。但是,如果我去“http:// localhost:8080/1”,那么它不起作用。我得到以下错误:
Not Found
The requested URL /1 was not found on this server.
如果我改变第一部分
F3::route('GET /anotherthing','home');
function home() {
echo F3::render('templates/index.html');
}
然后在 “HTTP://本地主机:8080/anotherthing” 也不起作用。它只是在根上工作。任何帮助?
更多信息 这是在httpd.conf配置
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">
Options -Indexes FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from All
</Directory>
Modrewrite启用:
LoadModule rewrite_module modules/mod_rewrite.so
而且htaccess的样子:
RewriteEngine On
RewriteBase /fatfree/
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /fatfree/index.php [L,QSA]
“/ fatfree /“基础是由于另一个答案这个问题有类似的问题。
我也试图与以下的.htaccess:
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
您是否启用了mod_rewrite并设置了规则(即在.htaccess文件中)? – madflow 2012-07-12 19:22:42
我添加了更多信息。谢谢。 – Tony 2012-07-12 19:39:43
那么你在哪里index.php?在DocumentRoot/fatfree中还是在文档根目录中? – madflow 2012-07-12 19:47:13