How can I fix Laravel 5.1 - 404 Not Found?

前端 未结 6 1360
小鲜肉
小鲜肉 2020-12-29 11:30

I am trying to use Laravel 5.1 for the first time. I was able to install it and https://sub.example.com/laravel/public/ is displaying what is should. However, v

6条回答
  •  悲&欢浪女
    2020-12-29 12:19

    if you are on ubuntu you shoud do 3 thing. 1. check if "/var/www/html/YourProject/public/ .htacess " is like this.

    
    
        Options -MultiViews
    
    
    RewriteEngine On
    # 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}]
    

    2. Add this lines on /etc/apache2/sites-available/000-default.conf

    
     AllowOverride all
     Require all granted
    
    

    Note: remember that is an system file so you should use this comamd

    sudo gedit /etc/apache2/sites-available/000-default.conf 
    
    1. by last enable rewrite module.

      LoadModule rewrite_module modules/mod_rewrite.so

    or

    sudo a2enmod rewrite
    

提交回复
热议问题