I want to create an API service powered by Lumen 5.4 which running in a shared hosting environment.
here's my folder structure
/public_html
|- api
|- public
|- index.php
|- .htaccess
the api
folder is the root of Lumen project.
and now I need to access http://example.com/api/public to access my Lumen project. What I want is directly access to http://example.com/api
So I try to put a .htaccess
in api
folder:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1
</IfModule>
What I trying to do is redirect all requests from api
folder to public
folder. At the end, requests to public
folder will all redirect index.php
The request was redirected to the public
folder and Lumen can already process it. But I get NotFoundHttpException in RoutesRequests.php line 594
error.
I refer to many references and all of them having the same RewriteRule
as I using. But how come it doesn't work at all on my shared hosting?
Any help would be appreciated.