2

我有一个包含许多路由路径的应用程序,如下所示 -

F3::route('GET /', 'Main->get_front_page');
F3::route('GET /login/check_for_login', 'Login->check_for_login');

第一条路线匹配正确。但是,第二条路线不匹配,我得到了 404。事实上,第一条之后的任何路线都不匹配。

更复杂的是,所有路由都在我的本地机器上运行。

4

2 回答 2

3

检查您的 apache .htaccess 文件。特别是RewriteBase网址。我经常倾向于忘记这一点:)

于 2012-03-19T12:04:08.127 回答
0

对于 Shared Hosting ,fatfree 框架部署不会像在本地服务器中那样工作。所以你需要创建一个 .htaccess 文件

# Enable rewrite engine and route requests to framework
RewriteEngine On

# Some servers require you to specify the `RewriteBase` directive
# In such cases, it should be the path (relative to the document root)
# containing this .htaccess file
#
# RewriteBase /

RewriteRule ^(tmp)\/|\.ini$ - [R=404]

RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

使用上述代码创建一个 .htaccess 文件,并将该文件放在您的 fat free 框架项目的根目录中。我试过了,效果很好。

于 2016-10-26T10:32:59.437 回答