jeudi 23 juin 2016

Laravel 5.1 giving 404 Not Found except Homepage

I have a website set up on Laravel 5.1. It throws a 404 error on any page except the homepage. However, when I add index.php in the URL, it works. My site runs on a Ubuntu machine with Nginx as the web server.

Loads fine: http://ift.tt/28R02VK

Gives 404: mysite.com/dashboard

My .htaccess in the public folder:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteBase /


    # 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]
</IfModule>

Thanks for your time and I would greatly appreciate any help.

Edit:

This is my Nginx conf:

server { server_name mysite.com; return 301 $http://ift.tt/ZzvktM; }

server { listen 80; server_name www.mysite.com;

# note that these lines are originally from the "location /" block
root   /usr/share/web/site/public;
index index.php index.html index.htm;

    location / {
            try_files $uri $uri/ /index.php?$query_string;
    }


error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
    root /usr/share/web/html;
}

location ~ \.php$ {
try_files $uri /index.php =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;

  #  fastcgi_pass 127.0.0.1:9000;
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;

    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

    fastcgi_max_temp_file_size 0;
    fastcgi_buffer_size 4K;
    fastcgi_buffers 64 4k;

    include        fastcgi_params;
}

}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28QspBW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire