# Htaccess redirect not working

**URL:** https://discourse.slimframework.com/t/htaccess-redirect-not-working/5535
**Category:** Questions
**Created:** [February 26, 2023, 9:47pm UTC](https://discourse.slimframework.com/t/htaccess-redirect-not-working/5535 "2023-02-26T21:47:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![n2fole00](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@n2fole00](https://discourse.slimframework.com/u/n2fole00)
#### Post date: [February 26, 2023, 9:47pm UTC](https://discourse.slimframework.com/t/htaccess-redirect-not-working/5535/1 "2023-02-26T21:47:59Z")

</div>

Hi, Locally, I have slim installed in [http://localhost/slim/public](http://localhost/slim/public) and can access a hello world in this directory.  
However, I would like to serve content from [http://localhost/slim/](http://localhost/slim/) and for this, I created a .htaccess file in the /slim directory with the following…

```auto
RewriteEngine on
RewriteRule ^$ slim/public/ [L]
RewriteRule (.*) slim/public/$1 [L]

```

However, Apache gives me an internal server error page when trying [http://localhost/slim](http://localhost/slim)

I also have this in my index.php

```auto
$app = AppFactory::create();
$app->setBasePath('/slim/public');

```

The other requirements have been met in accordance to [https://www.slimframework.com/docs/v4/start/web-servers.html#apache-configuration](https://www.slimframework.com/docs/v4/start/web-servers.html#apache-configuration)

What do I need to get things working from [http://localhost/slim/](http://localhost/slim/)

Thanks.

---

<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: [February 26, 2023, 11:02pm UTC](https://discourse.slimframework.com/t/htaccess-redirect-not-working/5535/2 "2023-02-26T23:02:45Z")

</div>

Hi!

Did you also create the 2nd .htaccess file according to the documentation?  
Please just copy the two .htaccess exactly as they are documented. You don’t need to change it.

Then set the Slim basePath to `/slim` and try it again.

---

<div class="post-metadata">

### Author: ![n2fole00](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@n2fole00](https://discourse.slimframework.com/u/n2fole00)
#### Post date: [February 27, 2023, 5:54am UTC](https://discourse.slimframework.com/t/htaccess-redirect-not-working/5535/3 "2023-02-27T05:54:05Z")

</div>

Thanks, that worked.
