jeudi 28 janvier 2016

Laravel route not working with file extension

I am trying to create a route in Laravel 5.1 that will work for a generic permalink.

Route::get('{generic_url}.html', 'Frontend\CMSController@generic');

When I go to a URL say /this-is-my-page.html I get a 404 page that does not originate from within Laravel (my custom 404 page does not appear). However, when I go to /http://ift.tt/1OTpYOT everything works fine.

I believe that this problem is originating from the configuration of the server. My .htaccess is as follows:

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

As I am still developing this solution, I am using the php -S localhost:8000 command to launch the web server. Could that be the cause of my problem? Is there something wrong with the default configuration? Should I move my development to a "real" server?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire