I have built something small using the Slim Framework for routing. Everything worked perfectly locally. I have rented a Droplet now and use a LAMP stack on Ubuntu 18.04. My App is located in the location /var/www/src/public
.
I have already added this into the apache.conf
:
<Directory /var/www/src/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
My 000-default.conf
already has the correct route setted.
My .htaccess.txt
is located in /public
with my index.php
which contains:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
I have already enabled mod_rewrite
for Apache.
When I call the servers IP address the main page is loaded successfully with Slim where the routing is set like this:
$app->get('/', function (Request $request, Response $response) {
return $this->renderer->render($response, "/index.php");
});
So Slim seems to be rendering my index.php
which is in the directory /var/www/views
correctly. This path is defined in the container like this:
$container['renderer'] = new PhpRenderer("../../views");
The problem starts when I try to reach for example the site ip_address/player
even though it is correctly routed and was functioning locally. Trying to reach it gives me this in the browser:
Not Found
The requested URL /player was not found on this server.
I have googled for several hours trying different solutions but I just can't get it to work. Any help would be greatly appreciated.
Should not it be .htaccess instead of .htaccess.txt. What kind of OS you're at?