0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

notfound

Posted at

VagrantでCentOS7の環境を新しく作って、
PHPやらApacheやらComposerやら色々導入して、Laravelで遊ぼうとしたときのこと。

とりあえず、http://

//public/ で初期画面見れてほっこり。

このとき、初期画面が見れるのは、routes/web.php に
こんな感じでルーティングが設定されているからですよね。

Route::get('/', function () {
return view('welcome');
});
ただ、今回起こったことは、
下みたいに、ルーティングを追加したときに Not Found が表示されました。 fugaだろうがfooだろうが全部 Not Found。

Route::get('/hoge', function () {
return 'Hello World';
});
/ でルーティングしたものは表示されてそれ以外はNot foundなもんで、
プロジェクト側の設定ミスか何かなのかな〜と思ってたらApache側でしたね。

httpd.confの中身を覗いてみると、


AllowOverride None
Require all granted

~
~

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named explicitly --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Require all granted
と の中の AllowOverride がNoneになってますが、 ここが原因だったみたいです。 それぞれ AllowOverride All に直して、Apacheを再起動してあげましょう。

$ systemctl restart httpd
これでルーティング上手く行きました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?