Laravel 403 Forbidden Error
Solution 1
Your .htaccess
is not parsed by apache because AllowOverride All
directive is missing inside virtualhost configuration. .htaccess
file is required for Laravel. Put back it. Then change apache virtual host configuration on server to allow .htaccess
.
<VirtualHost *:80>
ServerName www.example.net
DocumentRoot "/var/www/html/example3"
<Directory /var/www/html/example3>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Change your virtualhost like this and restart apache by sudo service apache2 restart
.
Replace www.example.net
and /var/www/html/example3
with correct details.
Solution 2
If you are using your own Request, change the authorize function to return true:
public function authorize()
{
return true;
}
As simple as that!
Solution 3
You can try these commands.
sudo chmod -R gu+w project_folder
sudo chmod -R guo+w project_folder
chmod -R 775 storage/
chmod -R 775 bootstrap/cache
Kiddo
Updated on July 16, 2022Comments
-
Kiddo almost 2 years
As title said, I got error 403 (title of page) on Laravel project. Locally, it's working, but when I'm trying to put it live, on a web-host/my domain it gives me:
Forbidden
You don't have permission to access / on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.I deleted
.htaccess
file from public folder, and nothing happened. Any solutions? -
giovannipds about 3 yearsInteresting reminder, though, didn't solve it to me.
-
Sebastian Manuelli over 2 yearsI fucking love you, been strugglin with this problem for more than 3 hours