@kencellarafood

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

.htaccess 404ページ

解決したいこと

ホームページ制作をしており、.htaccessファイルを用いて、オリジナルの404ページにリダイレクト設定をしたいのですが、ネットで調べて行うと上手くいきません・・・。

.htaccessファイルの記述がおかしいのでしょうか?
ちなみに、ファイル構造としては404ページ、.htaccessページともに、public_htmlの直下にあります。

ご教示いただけますと幸いです。

該当するソースコード



# php -- BEGIN cPanel-generated handler, do not edit
# “ea-php74” パッケージを既定の “PHP” プログラミング言語として設定します。
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^\.]+)$ $1.html [NC,L]
</IfModule>

ErrorDocument 404 /404error.html



0 likes

2Answer

どこのサーバーでどういうプランを使っているのかが不明ですが、大本の設定、AllowOverride ディレクティブがAllFileInfoを指定しない限り.htaccessでErrorDocumentは有効には成りません。

レンタルサーバーの場合、AllowOverrideを変えることはほぼ無理です。

2Like

Comments

  1. @kencellarafood

    Questioner

    ありがとうございます。解決致しました!

Comments

  1. @kencellarafood

    Questioner

    ありがとうございます。解決致しました!

  2. どのように解決されたんでしょうか?

Your answer might help someone💌