: ErrorDocument Not Working I've been trying to solve this problem, I have a virtual machine with the same setup as my production server. The ErrorDocument line in 000-default.conf works on my
I've been trying to solve this problem, I have a virtual machine with the same setup as my production server. The ErrorDocument line in 000-default.conf works on my VM, however it doesn't work on my production server.
The two seemingly different points are a) The production server has a security certificate and b) the 000-default.conf on the production server has mod_rewrite enabled while it's not being used, it is a difference.
I've disabled mod_rewrite to see what would happen, which has changed nothing. All documents
I have the default folder set (/var/www/html) and the only changes I've made to the 000-default.conf are as followed:
ErrorDocument 404 /error_pages/404.html
ErrorDocument 500 /error_pages/50x.html
ErrorDocument 502 /error_pages/50x.html
ErrorDocument 503 /error_pages/50x.html
ErrorDocument 504 /error_pages/50x.html
<Files "404.html">
<If "-z %{ENV:REDIRECT_STATUS}">
RedirectMatch 404 ^/404.html$
</If>
</Files>
<Files "50x.html">
<If "-z %{ENV:REDIRECT_STATUS}">
RedirectMatch 404 ^/50x.html$
</If>
</Files>
mod rewrite portion:
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.website.com
RewriteRule ^ %{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
I'm not sure if this would be a cause either, however, my certificate is only valid for the www, and not the bare URL.
Not sure where to go from here, the server displays the default apache error page.
More posts by @Bryan171
1 Comments
Sorted by latest first Latest Oldest Best
Thanks to w3dk's questions I was able to work through why my page re-directs weren't working.
I was using let's encrypt for my security certificate, and because of (or perhaps my lack of knowledge), it created a new .conf file with the lines to load the ssl certificates (000-default-le-ssl.conf) which took precedent over the original default.conf.
When I modified this new .conf file everything worked correctly.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.