Host Laravel Web Hosting Project

I want to host my laravel project on my web hosting.

My web hosting has a Public_html folder. Before Laravel, I could call my site using default.php or index.php in the Public_html folder. But in the laravel framework index.php is in the public folder.

How can I access Laravel/public/index.php from my Public_html ?

+5
source share
5 answers

This is the shared hosting that you use, if so, then:

Put the contents of public (L5) directly in public_html (remember that don't overwrite the .htaccess file by accident) and then change index.php and your bootstrap.php and it will work just fine

+3
source

2 Options:

  • create index.php in Public_html that includes your original index.php
  • if possible, change the document root in your .htaccess or in the configuration of your virtual host

In any case, you should be aware that everything in your Public_html will be visible to each user. So your business logic is not a good idea. Hidden files can be installed using .htaccess or if you place them outside the root directory. If you do not have the ability to change it, you should probably consider a virtual server.

+2
source

When I do a new installation of the Laravel project on my local host, I cut the .htaccess file from the shared directory and paste (replace) it into the root of the Laravel directory.

And I will rename the server.php file to the root of the Laravel directory on index.php

Thus, I eliminate the need to enter the word public from the website URL.

Now in public_html I insert all the files and folders from the Laravel directory. That way, when you enter your domain name, your site loads directly without showing your public / index.php inside the URL.

+1
source

All you really need to do is contact support and kindly ask them to set the root document to home/{domian}/{laravel-project-folder}/public instead of home/{domain]/public_html . some hosts even allow you to set your own document root directory. others need to contact them.

I just returned from one thing and it all worked. (after setting the correct write permissions to the necessary folders inside the project folder. https://laravel.com/docs/5.3/installation )

this allowed me to have a production experience identical to my local experience.

0
source

In cpanel, you have the option (if not disabled by the host) to set the shared directory for the subdomain or addon domain.

I did this in Laravel installations that are on addon domains,

0
source

All Articles