jeudi 3 décembre 2015

URL with trailing slashes gets redirected to localhost Laravel 5.1

I hit my url with http://localhost/project/women-fashion and its working fine but if I visit http://localhost/project/women-fashion/ it gets redirected to http://localhost/women-fashion.

My route:

Route::get('/{slug}/', 'SlugController@index')->where('slug', '[A-Za-z-0-9]+');

My htaccess:

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

    RewriteEngine On

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

How, I can redirect url with slashes at the end to url without slashes at the end ? Thanks, any help appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire