I am trying to create a custom 404 error for my website. I am testing this out using XAMPP on Windows.
My directory structure is as follows:
error\\4
Instead of adding them to your .htaccess file, you can add them to any of your virtual host files.
DocumentRoot /var/www/mywebsite
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorDocument 404 /error-pages/404.html
ErrorDocument 500 /error-pages/500.html
ErrorDocument 503 /error-pages/503.html
ErrorDocument 504 /error-pages/504.html
Where error-pages is a subfolder in the mywebsite folder, containing the custom error pages. Make sure you restart your apache to view your changes.
$sudo /etc/init.d/apache2 reload