bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
2.66k stars 446 forks source link

Dynamic Route not work on Hosting #1234

Closed pmtpro closed 2 years ago

pmtpro commented 3 years ago

Hello!

I really like fatfree, it really helps me a lot in my coding.

However, everything was fine until I put my product on Hosting.

Dynamic Route doesn't work as I expected, it always returns 404 error

My config:

GET /@controller/@action = App\Controllers\@controller->action@action GET /@controller = App\Controllers\@controller->actionIndex

GET / = App\Controllers\Home->actionIndex

Only Home is working.

I also tried several other cases and only the latter worked GET /Home/@action = App\Controllers\Home->action@action

geniuswebtools commented 2 years ago

Sounds like you didn't upload the .htaccess file to the server.

pmtpro commented 2 years ago

Sounds like you didn't upload the .htaccess file to the server.

Sorry, but I already uploaded .htaccess. My .htaccess

RewriteEngine On

RewriteRule ^(app|dict|ns|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]
geniuswebtools commented 2 years ago

Is the server using Apache? Is the apache modrewrite turned on?

geniuswebtools commented 2 years ago

Does the server require you to use the reweite base rule? RewriteBase /

pmtpro commented 2 years ago

Does the server require you to use the reweite base rule? RewriteBase /

yes, but the result is still the same

ikkez commented 2 years ago

when the hosts filesystem is case sensitive, also check the casing of file names. When you goto /home but the controller is named Home.php it may also fail.

pmtpro commented 2 years ago

when the hosts filesystem is case sensitive, also check the casing of file names. When you goto /home but the controller is named Home.php it may also fail.

Thank you very much After I renamed the file everything worked! ^^!