I have a shared hosting and I’m trying to make my laravel project works on it, I’m using voyager to the admin panel.
I put my app public folder inside the /public_html and the rest of the project on the same level of the /public_html, so it looks like this:
.bash_history
.bash_logout
.bash_profile
.bashrc
.cache
.cpanel
.htpasswds
logs
mail
app -> my project
public_ftp
public_html -> where my app public folder is
.ssh
tmp
etc
...
I have managed to work almost everything, but the admin panel is not working properly.
When I access www.example.com/admin it goes to www.example.com/admin/login, I put my credentials and submit the form, after it returns to the same page, then I checked the network tab on Chrome and it appears the following message:
Request URL: http://example.com/admin/login
Request Method: GET
Status Code: 403 Forbidden
Anybody knows how to fix it?
Thanks.
5
Answers
Hi your storage folder must be set permission 777
chmod -R 777
OR
sudo chown -R www-data:www-data /var/www (recomended)
Usually, you should copy your files of public folder to the public_html folder and put other folders outside of public_html because it is available to the whole world.
You should modify the public/index.php file will following details:
Since you have public folder inside public_html folder, you should add one more (..)
Domain or subdomain
Point your domain or subdomain to {{your_domain}}/public
Note:
Don’t forget to update your .env file
Permissions
Normally you don’t need to change files and folder permission. If you need to then set Folders to 755 and files to 644
For me, this was due to the
.htaccess
looking for a folder (that was forbidden) instead of using the Laravel route with the same name/admin
.See StackOverflow here :
Laravel, Admin controllers – 403 Forbidden
If you get any issue like that, then add
.htaccess
file in root folder, and put below code in that, it will start workingOptions -MultiViews -Indexes