dpjpo746884 2016-01-29 02:51
浏览 119

Laravel路由不使用文件扩展名

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 /index.php/this-is-my-page.html 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?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序
    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作