# Slim framework showing 404 error, please help

**URL:** <https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627>\
**Category:** Questions\
**Created:** [June 28, 2017, 7:42pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627 "2017-06-28T19:42:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![spunkalator](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@spunkalator](https://discourse.slimframework.com/u/spunkalator)\
**Post date:** [June 28, 2017, 7:42pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/1 "2017-06-28T19:42:26Z")

</div>

hello, im new to slim, i recently created a rest api with slim. It works well on my localhost, but when i moved it to a live server and tried to access the functions, it shows a 404 not found error… i dont know how to trouble shoot, pls help…

---

<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 28, 2017, 7:57pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/2 "2017-06-28T19:57:43Z")

</div>

The most likely cause is that you haven’t configured your production server to point to the front controller. For example if you are using Apache, make sure the (often hidden) `.htaccecss` file got copied up to the live server.

---

<div class="post-metadata">

**Author:** ![spunkalator](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@spunkalator](https://discourse.slimframework.com/u/spunkalator)\
**Post date:** [June 28, 2017, 8:05pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/3 "2017-06-28T20:05:01Z")

</div>

hello,

this is how my htaccess file looks like on the web server, is it correct?

`RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]`

---

<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 28, 2017, 8:53pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/4 "2017-06-28T20:53:01Z")

</div>

Assuming you are using Apache, is the `AllowOverride` set to allow the `.htaccess`?

---

<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 28, 2017, 8:54pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/5 "2017-06-28T20:54:06Z")

</div>

Also is your `DocumentRoot` the same in production as it is locally?

---

<div class="post-metadata">

**Author:** ![spunkalator](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@spunkalator](https://discourse.slimframework.com/u/spunkalator)\
**Post date:** [June 28, 2017, 9:02pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/6 "2017-06-28T21:02:08Z")

</div>

i dont know how to set document root…can u pls tell me which file it is in? is it through the htacess? ive been searching…

---

<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 28, 2017, 9:11pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/7 "2017-06-28T21:11:40Z")

</div>

In other words make sure that if locally your `index.php` file is in `/public` but your production server is setup with `index.php` in `/public_html` you will likely want to adjust your local server’s [vhost setup](https://httpd.apache.org/docs/current/vhosts/examples.html) to use a `DocumentRoot` that matches your server.

---

<div class="post-metadata">

**Author:** ![spunkalator](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@spunkalator](https://discourse.slimframework.com/u/spunkalator)\
**Post date:** [June 28, 2017, 9:17pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/8 "2017-06-28T21:17:52Z")

</div>

okay thanks, i really appreciate, everything seems to be found there…  
but do you think it could be routing? I read that if the application does not find a route matching the URI then it returns 404. How can i check if my routing is okay? thanks…

---

<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 28, 2017, 9:53pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/9 "2017-06-28T21:53:26Z")

</div>

If the routing works locally it _should_ work in production… doesn’t seem likely if it works locally. I’d also check your server log files to help figure out what you are hitting.

---

<div class="post-metadata">

**Author:** ![spunkalator](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@spunkalator](https://discourse.slimframework.com/u/spunkalator)\
**Post date:** [June 28, 2017, 9:58pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/10 "2017-06-28T21:58:41Z")

</div>

okay…thanks… one more please…😅 what could be the issue if a particular set of functions work, and some dont. eg my login and register function shows 404, but a function callled task works, and yet all are in the place…do you have any idea what the issue might be?

---

<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 28, 2017, 10:52pm UTC](https://discourse.slimframework.com/t/slim-framework-showing-404-error-please-help/1627/11 "2017-06-28T22:52:17Z")

</div>

Hard to say without seeing some code.
