My laravel installation was working fine yesterday but today I get the following error:
Forbidden
You don\'t have permission to access / on this server.
Ad
I had a problem with non-www website URL version - the PUT method has been not working. But when entering the website with www. - it works fine!
Create and put this .htaccess file in your laravel installation(root) folder.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
On public/.htaccess edit to
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
In the root of the project add file
Procfile
File content
web: vendor/bin/heroku-php-apache2 public/
Reload the project to Heroku
bash
heroku login
cd my-project/
git init
heroku git:remote -a my project
git add .
git commit -am "make it better"
git push heroku master
heroku open
For those who using Mamp or Mamp pro:
Open MAMP Pro
Click on “Hosts”
Click on “Extended” (UPDATE: Only if you are using MAMP Pro 3.0.6)
Check “Indexes”
Click “Save”
That’s it! Reload your localhost starting page and it should work properly.
This is solved my problem by adding this line:
DirectoryIndex index.php
For me this was simply calling route()
on a named route that I had not created/created incorrectly. This caused the Forbidden error page.
Restarting the web server allowed proper Whoops! error to display:
Route [my-route-name] not defined.
Fixing the route name ->name('my-route-name')
fixed the error.
This is on Laravel 5.5 & using wampserver.