通常、web.phpにURIを書けば動くはずだが
404エラーになる。
それもLaravelの吐き出すグラフィカルな404ではなく
旧来のApacheが出力する文字だけの404
↑ここに気がつくのが遅くてずっとweb.phpやcacheを疑っていたが
Laravel10の.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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
なんですが、
この
RewriteCond %{REQUEST_FILENAME} !-d
が曲者で
publicにディレクトリがなければって条件で
って意味なんですよね。
で、ワイは何をしていたかというと
publicに/event/enquete/imgというディレクトリを作り画像を置き
web.phpで
/event/enquete/login.htmlはLaravelを実行させたいと
Route::get('/event/enquete/login.html', ['uses' => 'App\Http\Controllers\EnquetemainviewController@index','as' => 'enquetemainview.index']);
していたら、
RewriteCond %{REQUEST_FILENAME} !-d
でpublicに/event/enquete/ディレクトリあるからhtaccessのindex.php行にはたどり着けずなので、Apacheに処理が返り、
でも、publicの/event/enquete/にはindex.htmlは無いから
Apacheが404エラーを出していた。。って寸法。
ということで、以下のように
publicに実ファイルが存在しなかったときのみ、Laravelのindex.phpが動くようにコメントアウトした。
<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] **コメントアウト
# Send Requests To Front Controller...
#RewriteCond %{REQUEST_FILENAME} !-d **コメントアウト
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
気づくのに時間がかかった・・悔しい