Slim - HTTP to HTTPS

Hello guys,
I have checked some posts on this topic but nothing seems to work and I did not find a clear response.
Let me first explain the context :
1 - I have a VPS at OVH
2 - I have installed my apache2 server quite a long time ago, working with slim using HTTP
3 - Recently I wanted to attached a webhook from a website to my server, but the webhook is only working with HTTPS protocol
4 - I decided to move my apache2 server to https, which I did and now I can access the content from HTTPS location.


The only thing that is working is the home page :
$app->get(’/’, function ($request, $response, $args) {
$data = array();

return $this->view->render($response, 'layout.html', $data);


When I try to reach the login page, it’s not working, and I get a “Not Found” response from Apache :
“The requested URL /login was not found on this server.”
$app->get(’/login’, function ($request, $response, $args) {

return $this->view->render($response, 'login.html', $data);


and to be more precise, no other route thant “/” is working.

I am guessing that somehow Slim is not referencing routes in https ?
I have to admit this is the first time I am using HTTPS so I am kind of lost

I have tested multiples solutions (without really undestanding I have to admit) :

  • .htaccess changed : How to redirect to HTTPS using SLIM 3
  • Slim config : adding
    container['environment'] = function () { _SERVER[‘HTTPS’] = ‘on’;
    return new Slim\Http\Environment($_SERVER);

Any idea to come back to route working in https ?

Hi @Flo19

This is a well known issue in combination with apache. It does’t matter if you use HTTP or HTTPS.

There are maybe other solutions, but I would like to tell you how it works for me on localhost (development) and for the most webhosting providers.

If you want to setup it manually, you can find more details here:

Thanks for the response and solutions,

I did find the issue :

it was a part of the new .conf file of the https server, that I did not copy,

The one concerning the directory and right on it.

After copying, everything works well,


Florent Dusanter
06 87 80 71 95