问题
I have an application with many routing paths as follows-
F3::route('GET /', 'Main->get_front_page');
F3::route('GET /login/check_for_login', 'Login->check_for_login');
The first route is matching properly. However, the second route is not matching and I am getting a 404. Infact, any route after the first one are not matching.
To make matters more complicated, all the routes are working on my local machine.
回答1:
Check your apache .htaccess file. Especially the RewriteBase
url. I often tend to forget this one :)
回答2:
For Shared Hosting , the fatfree framework deployment won't work like in local server. So you need to create a .htaccess file
# 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]
create an .htaccess file using the above code and place the file in the root of your fat free framework project. I tried this and works well.
来源:https://stackoverflow.com/questions/9769665/fatfree-routing-not-working-in-production