# Slim - HTTP to HTTPS

**URL:** <https://discourse.slimframework.com/t/slim-http-to-https/3326>\
**Category:** Questions\
**Created:** [August 8, 2019, 11:32am UTC](https://discourse.slimframework.com/t/slim-http-to-https/3326 "2019-08-08T11:32:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flo19](https://avatars.discourse-cdn.com/v4/letter/f/8c91f0/32.png) [@Flo19](https://discourse.slimframework.com/u/Flo19)\
**Post date:** [August 8, 2019, 11:32am UTC](https://discourse.slimframework.com/t/slim-http-to-https/3326/1 "2019-08-08T11:32:51Z")

</div>

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.

BUT

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);

```

})-\>setName(‘layout’);

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);

```

})-\>setName(‘login’);

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](https://discourse.slimframework.com/t/how-to-redirect-to-https-using-slim-3/1602)
- 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 ?

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [August 8, 2019, 6:35pm UTC](https://discourse.slimframework.com/t/slim-http-to-https/3326/2 "2019-08-08T18:35:18Z")

</div>

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.

- Example: [https://github.com/odan/slim-hello-world](https://github.com/odan/slim-hello-world)

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

- [https://github.com/slimphp/Slim/issues/2294#issuecomment-341887867](https://github.com/slimphp/Slim/issues/2294#issuecomment-341887867)
- [https://stackoverflow.com/questions/48932959/running-slim-framework-on-existing-apache-web-server/48945514#48945514](https://stackoverflow.com/questions/48932959/running-slim-framework-on-existing-apache-web-server/48945514#48945514)
- [https://odan.github.io/2017/11/30/creating-your-first-slim-framework-application.html](https://odan.github.io/2017/11/30/creating-your-first-slim-framework-application.html)

---

<div class="post-metadata">

**Author:** ![Flo19](https://avatars.discourse-cdn.com/v4/letter/f/8c91f0/32.png) [@Flo19](https://discourse.slimframework.com/u/Flo19)\
**Post date:** [August 15, 2019, 7:07pm UTC](https://discourse.slimframework.com/t/slim-http-to-https/3326/3 "2019-08-15T19:07:57Z")

</div>

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,

Regards

Florent Dusanter  
06 87 80 71 95
