jeudi 1 octobre 2015

Laravel redirect loop with default htaccess and wamp

So, I'm trying to get my Laravel 5 app running on a Win 8.1 machine with a WAMPSERVER installation.

The app is located @ [wamp]\www\hello-world. I have set up the necessary alias as required by wamp.

hello-world.conf:

Alias /hello-world/ "C:/wamp/www/hello-world/public/" 

<Directory "C:/wamp/www/hello-world/public/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    Allow from all
</Directory>

I have the default Laravel 5 .htaccess file in the public folder:

.htaccess:

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

    RewriteEngine On
    RewriteBase /hello-world/public/

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

In the Laravel app.php config file, I have the following defined:

    'url' => 'http://localhost/hello-world',

While I'm able to launch the home page index.html, any other dynamic routes like auth/login will all return a 500: Internal Server Error.

Interestingly, if I try to invoke the same route using index.php/auth/login it works just fine. So, I know its a .htaccess issue. I just can't figure out what.

I see the following in my apache error log:

 AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error.

I've been stuck on this for the last two days, found a whole bunch of threads on SO and elsewhere, tried all suggestions, but nothing seems to work for me.

I tried preventing the loop by using the following rule, but that doesn't seem to help either:

# Prevent requests for index.php from being rewritten, to avoid infinite loops
RewriteRule ^index\.php$ - [L]

PS: I have the rewrite_module enabled in apache and am able to verify it is working.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire