# Slim framework .htaccess in subfolder (don't work)

**URL:** <https://discourse.slimframework.com/t/slim-framework-htaccess-in-subfolder-dont-work/1832>\
**Category:** Questions\
**Created:** [September 24, 2017, 2:49pm UTC](https://discourse.slimframework.com/t/slim-framework-htaccess-in-subfolder-dont-work/1832 "2017-09-24T14:49:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![makitos666](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@makitos666](https://discourse.slimframework.com/u/makitos666)\
**Post date:** [September 24, 2017, 2:49pm UTC](https://discourse.slimframework.com/t/slim-framework-htaccess-in-subfolder-dont-work/1832/1 "2017-09-24T14:49:31Z")

</div>

I’m not clear on this from .htaccess and there is no way it works.

I have the following structure on my server:

```
- htdocs
  - rest
     - public
        index.php
     - Slim
     - vendor
 index.html
  - js
  - css
  etc...

```

In the folder htdocs I have the web page that consists of some html and js, and in the folder rest an apicacion with SlimFramework.

I only have one .htaccess in the rest folder, it contains:

```
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(restSlim) rest/public/index.php [QSA,L]
</IfModule>

```

And other in rest/public:

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

```

The website is displayed correctly when I access [example.com/](http://example.com/), which is exactly what I want. But when I make any request to [example.com/rest/public/](http://example.com/rest/public/)… I get a 404. I understand that they are trying to access the file and this is not happening to RewriteRule. What do I do wrong?

In case I do wrong, I also put an example path:

```
$app->get(
    '/test', 
    function (Request $request, Response $response) {
        return $response->withJson("works");
    }
);

```

Thank you very much!
