I want to host my laravel project in my web hosting.
In my web hosting, there is Public_html
folder. Before Laravel, I could call my website by using default.php
or index.php
in Public_html
folder. But in laravel framework, index.php
is in the public
folder.
How can I access Laravel/public/index.php
from my Public_html
?
Is it a shared hosting you're using if yes then :
Put the content of public (L5) directly on public_html (be aware of don't overwrite the .htaccess file accidentally) then modify your index.php and your bootstrap.php and it will work just fine
2 Options:
Either way you should be aware of the fact, that everything in your Public_html will be visible to every user. So putting your business logic there is not a good idea. Hidden files can be set with .htaccess or if you place them outside of your document root. If you have no possibility to change it you should probably think about a virtual server.
When I do a fresh installation of Laravel project on my localhost, I cut the .htaccess file from a public directory and paste(replace) it in the root of Laravel directory.
And I rename the server.php file in the root of Laravel directory to index.php
This way I eliminate the need for entering public word from the website URL.
Now in public_html, I paste the all files and folders from Laravel directory. This way when you type in your domain name then your website is loaded directly without showing your public/index.php inside the URL.
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