# Slim Api working fine with localhost but giving error on shared hosting

**URL:** <https://discourse.slimframework.com/t/slim-api-working-fine-with-localhost-but-giving-error-on-shared-hosting/3523>\
**Category:** Questions\
**Created:** [October 11, 2019, 7:46pm UTC](https://discourse.slimframework.com/t/slim-api-working-fine-with-localhost-but-giving-error-on-shared-hosting/3523 "2019-10-11T19:46:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krshubham1514](https://avatars.discourse-cdn.com/v4/letter/k/b77776/32.png) [@krshubham1514](https://discourse.slimframework.com/u/krshubham1514)\
**Post date:** [October 11, 2019, 7:46pm UTC](https://discourse.slimframework.com/t/slim-api-working-fine-with-localhost-but-giving-error-on-shared-hosting/3523/1 "2019-10-11T19:46:05Z")

</div>

## Details

**Type:** Slim\Exception\HttpNotFoundException

**Code:** 404

**Message:** Not found.

**File:** /home/sites/9a/9/902af2e37b/public\_html/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php

**Line:** 91

## Trace

#0 /home/sites/9a/9/902af2e37b/public\_html/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(57): Slim\Middleware\RoutingMiddleware-\>performRouting(Object(Slim\Psr7\Request)) #1 /home/sites/9a/9/902af2e37b/public\_html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(132): Slim\Middleware\RoutingMiddleware-\>process(Object(Slim\Psr7\Request), Object(Slim\Routing\RouteRunner)) #2 /home/sites/9a/9/902af2e37b/public\_html/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(89): class@anonymous-\>handle(Object(Slim\Psr7\Request)) #3 /home/sites/9a/9/902af2e37b/public\_html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(132): Slim\Middleware\ErrorMiddleware-\>process(Object(Slim\Psr7\Request), Object(class@anonymous)) #4 /home/sites/9a/9/902af2e37b/public\_html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): class@anonymous-\>handle(Object(Slim\Psr7\Request)) #5 /home/sites/9a/9/902af2e37b/public\_html/vendor/slim/slim/Slim/App.php(206): Slim\MiddlewareDispatcher-\>handle(Object(Slim\Psr7\Request)) #6 /home/sites/9a/9/902af2e37b/public\_html/vendor/slim/slim/Slim/App.php(190): Slim\App-\>handle(Object(Slim\Psr7\Request)) #7 /home/sites/9a/9/902af2e37b/public\_html/public/index.php(125): Slim\App-\>run() #8 {main}

---

<div class="post-metadata">

**Author:** ![pedropereira](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/pedropereira/32/982_2.png) [@pedropereira](https://discourse.slimframework.com/u/pedropereira)\
**Post date:** [October 11, 2019, 9:57pm UTC](https://discourse.slimframework.com/t/slim-api-working-fine-with-localhost-but-giving-error-on-shared-hosting/3523/2 "2019-10-11T21:57:22Z")

</div>

Can you show how you access the same resource on your localhost? The Url, I mean.

And what is your localhost server and your shared host server? (Php embeded, Apache, other)

---

<div class="post-metadata">

**Author:** ![abhishek](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@abhishek](https://discourse.slimframework.com/u/abhishek)\
**Post date:** [August 11, 2020, 12:31pm UTC](https://discourse.slimframework.com/t/slim-api-working-fine-with-localhost-but-giving-error-on-shared-hosting/3523/3 "2020-08-11T12:31:24Z")

</div>

Hello had you found any solution for that?

---

<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 12, 2020, 8:55am UTC](https://discourse.slimframework.com/t/slim-api-working-fine-with-localhost-but-giving-error-on-shared-hosting/3523/4 "2020-08-12T08:55:54Z")

</div>

This question has been discussed here many times 🙂

Here are some solutions:

- [Slim always returns 404](https://discourse.slimframework.com/t/slim-always-returns-404/4072)
- [Error in hello world :(](https://discourse.slimframework.com/t/error-in-hello-world/3360)
- [https://odan.github.io/2019/11/05/slim4-tutorial.html](https://odan.github.io/2019/11/05/slim4-tutorial.html)
- [https://github.com/selective-php/basepath#installation](https://github.com/selective-php/basepath#installation)
