Farid Movsumov
Farid Movsumov

Reputation: 12735

Laravel .htaccess not working

Laravel's default .htaccess file gives an error on Php Cloud server.

Error:

Option MultiViews not allowed here

When I remove section below from .htaccess my home page work but other routes gives an 404 error.

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

Original .htaccess file

<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>

Upvotes: 1

Views: 4696

Answers (1)

fideloper
fideloper

Reputation: 12293

Based on these Google results here and here, I think you need to append/edit:

RewriteBase /
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

so in total:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

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

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

Upvotes: 0

Related Questions