I'm having an issue with getting the ErrorDocument to work. I have tried most of the suggestions on most of the forms and posts. The only thing I know that I have that the others did not is the RewriteCond that was added by certbot.
I have done it in the past, but that was on an older version of ubuntu and was a self-signed site.
OS: Ubuntu 22.04
The current conf file
ServerAdmin webmaster@localhost
ServerName leofriclegends.com
ServerAlias www.LeofricLegends.com www.leofriclegends.com LeofricLegends.com *.LeofricLegends.com *.leofriclegends.com 92.27.77.101
DocumentRoot /var/www/leofriclegends.com/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorDocument 405 /404.html
ErrorDocument 500 /WebPageError.html
ErrorDocument 502 /WebPageError.html
ErrorDocument 503 /WebPageError.html
ErrorDocument 504 /WebPageError.html
<Files "404.html">
<If "-z %{ENV:REDIRECT_STATUS}">
RedirectMatch 404 ^/404.html$
</If>
</Files>
<Files "WebPageError.html">
<If "-z %{ENV:REDIRECT_STATUS}">
RedirectMatch 404 ^/WebPageError.html$
</If>
</Files>
RewriteEngine on
RewriteCond %{SERVER_NAME} =*.LeofricLegends.com [OR]
RewriteCond %{SERVER_NAME} =leofriclegends.com [OR]
RewriteCond %{SERVER_NAME} =www.LeofricLegends.com [OR]
RewriteCond %{SERVER_NAME} =LeofricLegends.com [OR]
RewriteCond %{SERVER_NAME} =www.leofriclegends.com [OR]
RewriteCond %{SERVER_NAME} =92.27.77.101 [OR]
RewriteCond %{SERVER_NAME} =*.leofriclegends.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
apachectl -S:
VirtualHost configuration:
*:443 leofriclegends.com (/etc/apache2/sites-enabled/leofriclegends.com-le-ssl.conf:2)
*:80 is a NameVirtualHost
default server leofriclegendslimitedserver.home (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost leofriclegendslimitedserver.home (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost industrialdimensions.co.uk (/etc/apache2/sites-enabled/industrialdimensions.co.uk.conf:1)
alias www.industrialdimensions.co.uk
alias www.IndustrialDimensions.co.uk
alias IndustrialDimensions.co.uk
wild alias *.IndustrialDimensions.co.uk
wild alias *.industrialdimensions.co.uk
port 80 namevhost leofriclegends.com (/etc/apache2/sites-enabled/leofriclegends.com.conf:1)
alias www.LeofricLegends.com
alias www.leofriclegends.com
alias LeofricLegends.com
alias 92.27.77.101
wild alias *.LeofricLegends.com
wild alias *.leofriclegends.com
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
Sites/Tutorials I have looked at:
I'm sure I have missed something blatant, or I need an additional step due to certbot. So any help will be welcome.
Thank you