FatFree routing not working in production

随声附和 提交于 2019-12-24 02:15:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!