Laravel - Forbidden You don't have permission to access / on this server

前端 未结 24 1878
灰色年华
灰色年华 2020-11-30 02:02

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         


        
24条回答
  •  旧巷少年郎
    2020-11-30 02:07

    It was solved for me with the Laravel default public/.htaccess file adding an extra line:

    The /public/.htaccess file remains as follows:

    
        
            Options -MultiViews
        
    
        RewriteEngine On
        DirectoryIndex index.php # This line does the trick
    
        # Redirect Trailing Slashes If Not A Folder...
        RewriteCond %{REQUEST_FILENAME} !-d
        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}]
    
    

提交回复
热议问题