LoginSignup
0

More than 5 years have passed since last update.

Express4.xのディレクトリインデックスでハマった話

Posted at

ファイル構成

/404/index.ejs (404の場合ここへリダイレクトするよう設定してある)
/403/index.ejs

どうしたいのか

http://example.com/403/ にアクセスした時にindex.ejsを表示したい

現象

http://example.com/403/ にアクセスしても404に繋がる

原因

.ejsにしていたのが原因

解決方法

.htmlにすればいい

.ejs を使いたい場合

app.get('/path', function (req, res) {});とか書いて自分でルーティングすればいい(と思う)

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