php - 带有 index.php 的 laravel 5.8 路由重定向到根路由
问题描述
如何将localhost:8000/index.php
重定向路由到localhost:8000
路由或404 status
在 laravel 5.8 中,因为localhost:8000/index.php
损坏了我所有的 css 链接而不是漂亮的 URL,所有内部链接都是这样的localhost:8000/index.php/about
解决方案
默认情况下,Laravel 提供了正确的 .htaccess,但如果你愿意,你可以尝试另一种方法:只需为这种情况创建一个路由:
Route::get('{file_name}.php', 'YourMainController@yourMainAction')
->where('file_name', '[a-zA-Z0-9\-\_]+');
推荐阅读
- java - Ask vs Tell or forward for Actors using Akka Streams
- c# - c# 中的存储过程输出参数返回 Empty where as Working fine while Executing in SQL
- android - 到处都是missingDimensionStrategy - 没有更好的方法吗?
- laravel - laravel - Vuejs 路由与 Laravel 路由冲突,试图发出 axios 请求
- java - 用maven构建的jar文件找不到配置文件
- haskell - Haskell - 计算列表中某个值的出现次数
- android - LiveDataReactiveStreams:将 Flowable 转换为 LiveData 不起作用
- javascript - WebStorm:无法捕捉用 jQuery
- excel - 单元格循环的工作表单元格值更改
- mvvmcross - MVVMCross 是否使用 tcp 来获得远程视图