路由适用于localhost,但不适用于生产服务器

I have a fresh installation of Laravel. It works perfectly fine on my local machine. But on the server the routes doesn't work correctly.

Here's how the URL looks like on my localhost:

localhost/articles/14

But when I try the same URL on my production server it doesn't work. But it does work if I type the URL like this:

mydomain.com/index.php/articles/14

So, with the index.php in between it works fine. And the index route works without a problem. So it seems like some kind of redirect issue.

Here's how my .htaccess file looks like:

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

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

I tried adding RewriteBase /mypath/ to the .htaccess without luck.

I have searched on Google and tried some suggestion without luck.

Check if mod_rewrite is enabled on your server.

Also, .htaccess may be disabled on your server for security reasons. Try putting your mod_rewrite on your <VirtualHost> or <Directory> section.