By default Lumen "same as Laravel" has myApp/public directory to put all the public files (assets).
I want to change that directory path from myApp/public to myApp/src/custom/public. How can I do achieve this?
By default Lumen "same as Laravel" has myApp/public directory to put all the public files (assets).
I want to change that directory path from myApp/public to myApp/src/custom/public. How can I do achieve this?
On
I believe you should "point" your vhost to the new location (assuming you moved/renamed the public dir to your desired path). This is only needed is your server is not yet configured this way.
Then open the index.php from your new location and "fix" the path to bootsrap/app.php
Then open server.php from the Lumen base dir and edit your paths in both locations you find "public" mentioned.
Didn't really test this but looks like it should work. Give it a try.
On
I also struggled with this and found a soltuion elsewhere.
I wanted the following directory structure:
.hosting root dir
├── lumen_app_dir <---
├── other_app_dir
├── etc...
└── public_html
└──lumen_app_public_dir <---
So I did the following:
index.php and .htaccess from lumen_app_dir/public to the lumen_app_public_dir.Changed the index.php there like this:
$app = require __DIR__.'/../../lumen_app_dir/bootstrap/app.php';
$app->run($app['request']);
The important part here is, that I had to include $app['reqest'] as the parameter for run function.
And it just works without any change in the default .htaccess file. I can access the Lumen installation at server.dev/lumen_app_public_dir
Got the same problem, and solved it. Look here, maybe it will help you. I have done this solution for my Lumen application, which works for me.
UPDATE
Ok, let's go proceeding some changes to make the system to work with your tree.
Add a
.htaccessfile in the root of your application so in the directorymyApp\. Write it in :Assuming that you have configured your vhost pointing to
\Path\myApp, we now accede to the index file ofmyApp\src\custom\public\. If we didn't make any mistakes, then we should get to a page that indicates an error, telling us that thebootstrap/app.phpfile is not found. Logic.We must therefore change the index.php file in the directory
myApp\src\custom\public:Change from this :
To this :
You can now get your home page directly from the path wanted.