私が持っている.htaccessファイルは、「エラー」と呼ばれるサブフォルダで404.htmlドキュメントを見つけることができません。特に行は次のとおりです。
ErrorDocument 404 /error/404.html
ただし、404.htmlを.htaccessと同じディレクトリに配置し、行を次のように変更すると、次のようになります。
ErrorDocument 404 /404.html
- - できます!
それが役立つ場合は、 XAMPP for Windowsを使用しています。httpd.confファイルでは、関連するディレクティブが次のように設定されています(冗長性があることに気付きました)。
<Directory />
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI MultiViews
AllowOverride All
Require all granted
</Directory>
また、私のDocumentRootは「C:/ xampp / htdocs」に設定されており、「エラー」ディレクトリにアクセスするためにさまざまなパスを試しましたが、機能しません。
ErrorDocument 404 /error/404.html
ErrorDocument 404 /flchi/error/404.html
ErrorDocument 404 /sites/flchi/error/404.html
ErrorDocument 404 /htdocs/sites/flchi/error/404.html
ああ、そしてそれが価値があることの最後の1つは、仮想ホストを使用していることです。関連するビットは次のとおりです。
<VirtualHost *>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
ServerAlias localhost
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost flchi.local>
DocumentRoot "C:/xampp/htdocs/sites/flchi"
ServerName flchi.local
ServerAlias flchi.local
<Directory "C:/xampp/htdocs/sites/flchi">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>