# Slim Framework used in Web Hosting Subdomain

**URL:** <https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585>\
**Category:** Questions\
**Created:** [June 17, 2017, 7:51pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585 "2017-06-17T19:51:54Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![alfredods](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@alfredods](https://discourse.slimframework.com/u/alfredods)\
**Post date:** [June 17, 2017, 7:51pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/1 "2017-06-17T19:51:54Z")

</div>

Hello,

I wrote a small Slim rest api. Locally works without problem. When I moved the api to my web hosting inside a sub domain, I get the following error:

> Internal Server Error  
> The server encountered an internal error or misconfiguration and was unable to complete your request.  
> Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error.  
> More information about this error may be available in the server error log.  
> Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

I have a web hosting in 1und1 in Germany. Inside the main root of my hosting I create a folder and put inside this folder the Slim application. This folder is mapped with a subdomain of my domain.

My .htaccess was put inside the folder of the slim application and contains the following:

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

Please I need help!

Best regards

Alfredo

---

<div class="post-metadata">

**Author:** ![llvdl](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/llvdl/32/78_2.png) [@llvdl](https://discourse.slimframework.com/u/llvdl)\
**Post date:** [June 17, 2017, 9:39pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/2 "2017-06-17T21:39:14Z")

</div>

If you can, find out what is in the PHP error log on the server. It should contain the error and give a hint on how to solve the problem. Perhaps the PHP version on the web hosting server is incorrect.

If you can’t get to the error log, you can try enabling the [displayErrorDetails](https://www.slimframework.com/docs/objects/application.html#slim-default-settings) setting, so the error message is shown in the HTML output.

---

<div class="post-metadata">

**Author:** ![alfredods](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@alfredods](https://discourse.slimframework.com/u/alfredods)\
**Post date:** [June 18, 2017, 7:27am UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/3 "2017-06-18T07:27:14Z")

</div>

Hello llvdl,

thank you for your answer!

Unfortuntelyy I can’t get the logs on the server because I have a WebHosting and I have access just to my root folder.

The version of PHP on this server is the 5.5.38.

I configure Slim with displayErrorDetails setting but I get the same error. I thing that the request to this API doesn’t reach the php code and previously the server breaks the request and send this error back.

As I say, I have a domain, e.g. [http://www.mydomain.de](http://www.mydomain.de) and in by my web hosting provider I have just access to a folder that is the root web folder. I create a subdomain, e.g. [http://subdomain.mydomain.de](http://subdomain.mydomain.de), that is mapped to a sub folder on this root. On this subdomain I put all the Slim code. Locally works without problems.

I need help please.

Best regards

Alfredo

---

<div class="post-metadata">

**Author:** ![alfredods](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@alfredods](https://discourse.slimframework.com/u/alfredods)\
**Post date:** [June 18, 2017, 7:47am UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/4 "2017-06-18T07:47:29Z")

</div>

Result of the remote server using RESTClient in Firefox:

 ![](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/7a298149cfab2825eac8ffb8f14071982773b010.png)

 ![](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/21ecb2142137e915e3e532d7a6920a33def9b7e1.png)

Result of the localhost:

 ![](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/aa7ae8892d6712276904d6b0305056c8a29c9afd.png)

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [June 18, 2017, 12:41pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/5 "2017-06-18T12:41:11Z")

</div>

Without being able to view the actual error message you are going to have a difficult time troubleshooting this. If you do figure it out, realize that you will have similar difficulty figuring out future errors as well if you can’t access the error details.

Does a simple `index.php` file with a simple `echo 'hello world';` work? What about the [Slim-Skeleton](https://github.com/slimphp/Slim-Skeleton), can you get that to work?

---

<div class="post-metadata">

**Author:** ![alfredods](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@alfredods](https://discourse.slimframework.com/u/alfredods)\
**Post date:** [June 18, 2017, 4:59pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/6 "2017-06-18T16:59:49Z")

</div>

Hello tflight,

thank you for your answer!

The problem is the apaache configuration. I delete the .htaccess file and it works. Of course only by writing the index.php in the url. It means I access to this rest api using:

htttp://sudomain.mydomain.de/index.php/

I will to take a look on the apache documentation to get the desired urls in the form [http://subdomain.mydomain.de/](http://subdomain.mydomain.de/).

Regards

Alfredo

---

<div class="post-metadata">

**Author:** ![Keust](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@Keust](https://discourse.slimframework.com/u/Keust)\
**Post date:** [November 28, 2017, 12:16pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/7 "2017-11-28T12:16:00Z")

</div>

Hi Tim,

Have the same issue. A simple echo won’t show. If i delete the .htaccess, the echo in the file does work.  
The php version is: 5.4.16 (not sure if this is of any use).

Without the .htaccess file the [domain.com/index.php](http://domain.com/index.php) -\> still a blank page.

Not sure where to look or how to get the server logs.

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [November 28, 2017, 1:08pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/8 "2017-11-28T13:08:15Z")

</div>

Slim 3 requires PHP \>= 5.5.0. `phpinfo()` will show you where your error logs are, look for the `error_log` directive and make sure they are turned on (check `log_errors`).

---

<div class="post-metadata">

**Author:** ![Keust](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@Keust](https://discourse.slimframework.com/u/Keust)\
**Post date:** [November 29, 2017, 11:55am UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/9 "2017-11-29T11:55:57Z")

</div>

The environment is set to PHP 7.0.  
This morning the website worked (not sure anymore what was in a .htaccess file) until I tried to implement to SSL rules.

At this point I keep getting “500 Internal Server Error” - Is this always a .htaccess problem?

With:  
`php <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ public_html/ [L] RewriteRule (.*) public_html/$1 [L] </IfModule>`  
I get a 500 Internal Server Error.

With  
`php RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L]`  
I get a blank page.

With  
`php <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </IfModule>`  
I also got a blank page

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [November 29, 2017, 1:18pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/10 "2017-11-29T13:18:35Z")

</div>

No, a `500` is not always an `.htaccess` problem. You need to look at the server logs to see what the exact error says.

---

<div class="post-metadata">

**Author:** ![Keust](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@Keust](https://discourse.slimframework.com/u/Keust)\
**Post date:** [November 29, 2017, 1:35pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/11 "2017-11-29T13:35:02Z")

</div>

From the domain I got back:

```php
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 

```

Google did not do the trick for me.

It this point:

```php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
</IfModule>

```

Is this the .htaccess. Result: Blank page.

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [November 29, 2017, 1:53pm UTC](https://discourse.slimframework.com/t/slim-framework-used-in-web-hosting-subdomain/1585/12 "2017-11-29T13:53:45Z")

</div>

Sounds like you have an infinite loop of redirects. I don’t know about your environment and what might be required. I do something like this to force HTTPS, but my environment is likely to be different.

```auto
RewriteCond %{ENV:HTTPS} !on [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R,L]

```
