为什么这个 Laravel5 资源路由 404?
Why does this Laravel5 ressource route 404?
在文件 routes.php 中我添加了行
Route::resource('tasks', 'TasksController');
然后使用 artisan 生成 TasksController
php artisan make:controller TasksController
.
那么为什么 localhost/blog/public/tasks
返回 404?
您需要启用 mod_rewrite
。您可以在 Laravel installation guide.
阅读更多内容
您还需要将域的根指向 /path/to/your/app/public 并在其中包含以下 .htacces:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
localhost/blog/public/index.php?tasks
您必须通过 /public/index 传递所有请求。php
执行此操作的最佳方法是将 DocumentRoot
设置为 /public/index.php/
并向具有简单域的主机文件添加条目,例如。 laravel.app
映射到 127.0.0.1
在文件 routes.php 中我添加了行
Route::resource('tasks', 'TasksController');
然后使用 artisan 生成 TasksController
php artisan make:controller TasksController
.
那么为什么 localhost/blog/public/tasks
返回 404?
您需要启用 mod_rewrite
。您可以在 Laravel installation guide.
您还需要将域的根指向 /path/to/your/app/public 并在其中包含以下 .htacces:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
localhost/blog/public/index.php?tasks
您必须通过 /public/index 传递所有请求。php
执行此操作的最佳方法是将 DocumentRoot
设置为 /public/index.php/
并向具有简单域的主机文件添加条目,例如。 laravel.app
映射到 127.0.0.1