HTTP ERROR 500 on my first slim code

I’m new to php and slim too.
I installed on my W10 laptop xampp, vs code and slim(using composer)
I wrote code and tested locally … it works fine.

Then I copy on my shared linux server via filezilla and it doesn’t work (I got http error 500)
I follow then suggestions in documentation and modify files as follow…,


< IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
< /IfModule>


< ?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;

require DIR . ‘/vendor/autoload.php’;

$app = AppFactory::create();


$app->get(’/’, function (Request $request, Response $response, array $args) {

if (!empty($_SERVER['HTTP_CLIENT_IP']))
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
  $ip = $_SERVER['REMOTE_ADDR'];

$yourip= file_get_contents(“{$ip}/json”);

return $response->withHeader(‘Content-Type’, ‘application/json’);



the skeleton of subdomain folders into linux web server is:

-------------\VENDOR (as on my laptop with all subfolder)
------------ .HTACCESS
------------ COMPOSER.JSON
------------ COMPOSER.LOCK
------------ INDEX.PHP

When I enter mysubdomain into chrome url I got error 500 and inside Plesk Log of my server I see 8 Apache errors refering to a non-existent subfolders e.g.:

Error: Unable to find the directory /var/www/vhosts/MYDOMAIN/MYSUBDOMAIN/var/www/vhosts/MYDOMAIN/MYSUBDOMAIN/vendor/slim/slim/Slim: filemng failed: filemng: stat failed: No such file or directory System error 2: No such file or directory

and much more similar to this one.

I suppose I make a mistake somewhere… Anybody can tell me where?
thanks a lot.

Usually you don’t need RewriteBase /MYSUBDOMAIN when you configure the correct apache DocumentRoot path.


This path is not correct. You should point the document root to your public/ directory of the Slim project.

Thank you very much Odan.
I removed RewriteBase and now it works.

Have a nice day.