Problem with hosting the API on my Synology


#1

I have already created a REST-API with SlimFramework which is hosted on XAMPP local on my PC. It is working perfect on my PC but when i want to put it on my “Live System” Synology NAS (Synology DS216+II) it always gives me an Error 404 and i have no clue why.

On my Synology NAS (Synology DS216+II) there is a Apache Server running (Version 2.2)
Since i know that my API does not work on the Synology i tried to implement the “demo” example at https://www.slimframework.com/

Error Message Synology:

Response when i call the same code on my PC with the local XAMPP:
image
it does what it should do…

But why am I getting this Error on my Synology?
I would be happy about some help


#2

The url should not contain the string index.php.

The src/* folder is only for PHP class files reserved and should be “private”.
Better put the index.php file into the public folder and define it as your DocumentRoot directory in apache.

DocumentRoot /var/www/example.com/public

Do you have a .htaccess in the public folder?

Content of public/.htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]