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?
The 403 Forbidden error appears when your server denies you permission to access a page on your site. This is mainly caused by a faulty security plugin, a corrupt . htaccess file, or incorrect file permissions on your server.
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.
If you are using your own Request, change the authorize function to return true:
public function authorize()
{
return true;
}
As simple as that!
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