I have singlepage app at https://example.com . App's api and backend is driven by laravel. Can someone point me to the right direction how to open my spa at: https://example.com and backend at https://example.com/backend
What I've tried:
I've put all my files of SPA in public folder and move laravel public files (including .htaccess and index.php) in public/backend folder
Changed the public path of laravel to public/backend
This gives me Internal Server Error when access https://example.com/backend
Thanks in advance!
Edit your routing so the api
group is changed to backend
. Then create a route in the web
group for /
which loads a blade template containing your vue components and vue router. The vue router will handle the SPA page loads after its loaded.
In this case you'll have an entry point for your backend which is index.php
. And you'll have an entry point for your SPA which will be index.html
. I would advice you to keep your index.php
in the /public
folder of our Laravel installation. Then change the way index.html
is compiled so it's placed in a different folder, lets say /build
. You can probably achieve this by adjusting some webpack or vue-cli settings. Then adjust your webserver configuration (apache/nginx) so it will have the following two entries:
/var/www/{project}/public
/var/www/{project}/build
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.