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
You might be facing the file permissions issue. Verify your htacces file, did it change from yesterday ? Also, if you were doing any "composer update" or "artisan optimize" stuff, try chowning your laravel project folder for your username.
chown -R yourusername yourlaravelappfolder
EDIT: the problem is possibly due to your local file permissions concerning Vagrant. Try to
set the permissions to the Vagrantfile containing folder to 777
I've found solution
I put following code into my public/.htaccess
and now its running at rocket speed :D
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# 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]
</IfModule>
Have you tried to change the .htaccess file that laravel suggested if the default one doesn't work? I had this similar problem and changed it to
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
and it soleved :)
Chances are that, if all the answers above didn't work for you, and you are using a request validation, you forgot to put the authorization to true.
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class EquipmentRequest extends FormRequest {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() {
/*******************************************************/
return true; /************ THIS VALUE NEEDS TO BE TRUE */
/*******************************************************/
}
/* ... */
}
Just add a .htaccess
file in your root project path with the following code to redirect to the public folder:
.HTACCESS
## Redirect to public folder
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
Very simple but work for me in my server.
Regards!
For me, It was just because I had a folder in my public_html named as same as that route!
so please check if you don't have a folder with the address of that route!
hope be helpful