Laravel framework is awesome to use. But for beginners, it might be irritating to fix the issue where user needs to goto /public
file to access newly created project. If that is your case, well, you are at right place.
The process is very simple with only 2 steps. Here are the steps.
- Goto to your laravel root folder of your project and you will find
server.php
file. - Rename
server.php
toindex.php
. - Now goto
/public
folder and find.htaccess
file. If you don’t find.htaccess
file, it means you have turned offshow hidden file
setting in your computer. Here is steps on how to show hidden files.- Mac users:
- Press
Command+Shift+.
and you will be able to see all hidden files. - And if you want to hide again, Please the same keys and you are done. So easy.
- Press
- Windows users:
- Under
View
menu, checkHidden items
And you are good to go.
- Under
- Mac users:
- Copy the
.htaccess
file from/public
folder to your Laravel root folder. - Now open your website
localhost:8888/your_project
. Isn’t is working now? I hope so.
This way, you can enable accessing your website directly from your root folder instead of typing /public
which doesn’t even look better for the website. I hope once day Laravel team will do the changes within its framework without need to do anything at first place. But till that time, well here is the solution for you guys.
I hope, this helped you. If so, don’t forget to share and it would be highly appreciated if you give a like for this post. Let me know if you have problem. I will be happy to help you.
Thanks
Leave a Reply