Evilbleezard
Evilbleezard

Reputation: 69

Laravel page not found after creating .htaccess

I'm using laravel for the first time i was used to work with lumen and i always used the .htaccess to redirect the root to the folder '/public' so i can call my routs directly from the root folder. but when i do the same on laravel it doesnt work telling me "Sorry, the page you are looking for could not be found."

Here is the .htaccess i used to add in lumen's root but doesn't work on laravel

<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule>

what i'm i doing wrong?

Upvotes: 0

Views: 416

Answers (1)

SyamsulMJ
SyamsulMJ

Reputation: 39

Try using this in your .htaccess. It works on mine. Cheers.

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

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]

    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ server.php

</IfModule>

Upvotes: 2

Related Questions