如何在Laravel 5.8中将localhost:8000/index.php
路由重定向到localhost:8000
路由或404 status
因为localhost:8000/index.php
破坏了我所有的CSS链接,但没有漂亮的URL,并且所有内部链接都像这样localhost:8000/index.php/about
答案 0 :(得分:0)
默认情况下,Laravel提供适当的.htaccess,但如果需要,您可以尝试另一种方法:只需为这种情况创建一条路线:
Route::get('{file_name}.php', 'YourMainController@yourMainAction')
->where('file_name', '[a-zA-Z0-9\-\_]+');
答案 1 :(得分:0)
请剪切您的公用文件夹index.php和.htaccess文件,然后粘贴到该文件夹的外部,并删除该目录
require __DIR__.'/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/bootstrap/app.php';