When I use artisan serve project works fine on localhost:8000 but I need to run project from localhost/, when I visit localhost/project/public code don't work correctly, any solution?
Are you using Linux? If you are, then I have instructions for you that should help both for the current project and the future projects:
The best approach is to create a virtual host for your project. For future projects, you will simply repeat the same process.
To save you time, I have put together a clear tutorial on how to do so by creating a conf file. This will enable you to access your project by actually visiting a local domain like demo.local instead of localhost:8000 etc.
Here is the tutorial : How to setup a virtual host in Ubuntu (Laravel Example)
I hope this helps and if you have further questions, please let me know.
Create a virtual host configuration file at
/etc/apache2/sites-available
(Simply copy the default.conf file) and point the directory root to the folder containing your laravel project. Best is to copy your files to
/var/www/html/ ...project folder...
and make the public laravel dir document root in your confit file.
You can find more information on creating vhost files in many answers here on stackoverflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With