Pretty URLs
Apache
Laravel includes a public/.htaccess file that is used to provide URLs without the index.php front controller in the path. Before serving Laravel with Apache, be sure to enable the mod_rewrite module so the .htaccess file will be honored by the server.
.htaccessを見てみましょう
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
あれ、ナニコレ、要するに、laravelのroutingってrewriteEngineで301リダイレクトさせてるってこと!?
Handle Authorization Header、Redirect Trailing Slashes If Not A Folder…、Handle Front Controller…って書いてますね。
RewriteCondはRewriteRule を実行するための条件を定義するための記述
ってことは、 %{HTTP:Authorization}、%{REQUEST_FILENAME}、%{REQUEST_URI} この辺は条件か。
REQUEST_URI リクエストURI
REQUEST_FILENAME リクエストされたファイル名
あーーーーーーなるほど、ドキュメントはやべーわ。フレームワークの重要なこと、全部書かれてるっぽい。
なるほど、フレームワーク使う時は、ドキュメント全部読まないと駄目だわこりゃ。
うわーーーーーーー頭いてー