项目为laravel网站上的项目:http://laravelacademy.org/post/2265.html
当部署完成后,用浏览器打开首页出现 /blog not found 的404错误。
routes.php代码如下:
<code><?php
Route::get('/', function () {
return redirect('/blog');
});
Route::get('blog', 'BlogController@index');
Route::get('blog/{slug}', 'BlogController@showPost');
?></code>尝试操作:
直接取消redirect重定向,修改成:
<code><?php
Route::get('/', 'BlogController@index');
Route::get('/{slug}', 'BlogController@showPost');
?></code>并修改视图中的跳转链接,将 /blog/{slug} 修改成 /{slug}
结果,主页是出来了,但是二级页面还是出不来。提示404 notfound!
源码链接:https://github.com/digjack/Blog
项目为laravel网站上的项目:http://laravelacademy.org/post/2265.html
当部署完成后,用浏览器打开首页出现 /blog not found 的404错误。
routes.php代码如下:
<code><?php
Route::get('/', function () {
return redirect('/blog');
});
Route::get('blog', 'BlogController@index');
Route::get('blog/{slug}', 'BlogController@showPost');
?></code>尝试操作:
直接取消redirect重定向,修改成:
<code><?php
Route::get('/', 'BlogController@index');
Route::get('/{slug}', 'BlogController@showPost');
?></code>并修改视图中的跳转链接,将 /blog/{slug} 修改成 /{slug}
结果,主页是出来了,但是二级页面还是出不来。提示404 notfound!
源码链接:https://github.com/digjack/Blog
在 Nginx,在你的网站配置中增加下面的配置,可以使用「优雅链接」
<code class="php">location / {
try_files $uri $uri/ /index.php?$query_string;
}</code>或者/index.php/blog
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号