I currently new for deploying a project files to the godaddy hosting sites, so before i post this, I read some related question created already here in stackoverflow, I just confuse because there cpanel has public_html folder and my panel has no public html. so right now I experience
HTTP Error 404. The requested resource is not found.
The things only I do is to move the laravel files in the httpdocs.
My CPanel : Plesk Onyx 17.8.11
For the folder structure:
So Inside of httpdocs are all of my laravel files
Website shows like this..
Hope someone help me for this problem.
2
Answers
I think the reason your folder structure is like this is that your GoDaddy Hosting is a Windows Shared Hosting.
What to basically need to do is create a folder for your app on the home directory and then on the httpdocs, put the public folder from your app.
GoDaddy Plesk Folder List:
Inside the httpdocs folder:
Once this is complete, you will need to edit a few files:
From Public Folder: index.php
Find:
Change to:
Next Find:
Change to:
After this, make sure the .env file is properly configured and all the tables from your local database is mirrored in you server database.
Also, if you have open_dir problems, you can disable it on the PHP Settings from Plesk but I am not sure what are the issues this will cause in the long run.
Well, there are two ways…
1st in cpanel search for "Installatron Applications Installer" or somekind of app installer 🙂
In installatron app installer screen on right top find "Applications Browser" from there search for Laravel and install it by choosing your domain(If you have more than one domain)
After installation copy and replace your local files with the remote files.
2nd second way, .zip your local laravel folder. And upload your files to your server, and then extract the files.
NOW FROM HERE IT’S THE SAME FOR BOTH WAYS->
"public" directory in laravel project will be in the root of your remote server(root folder for your domain, If you have addon domains for ex. public_html/example.com then "public" folder should be in that example.com)
make another folder and put all other laravel files and folders in that folder.
open and edit /public/index.php
change these two lines->
require DIR.’/../vendor/autoload.php’;
app = require_once DIR.’/../bootstrap/app.php’;
to reflect the file structure in your server.
For ex. if "public" folder is in the same directory with "vendor" and "bootstrap" remove /..
PS: do not change database host address it should remain same.
AND FINALLY the .htaccess files
you need to have two .htaccess files
one in "public" directory content like this->
Second .htaccess file will be in the root folder of the domain with content->
ONE PROBLEM YOU MIGHT COME ACCROSS if php version problem stating that composer dependencies version is php7.xx bla bla
If this happens go to cpanel again and search for "Select PHP Version"
From there change your current PHP version to suit with the PHP version you get in the error. And you need to click "Set as current"!
That’s it 🙂