So I've spent a fair bit of trying and reading including the http://httpd.apache.org/docs/2.2/custom-error.html
and I sadly can't get it all to align.
What I'm trying to do (with Ubuntu 13.10 & Apache2) is the following: Use virtualhosts. Have the default site and all virtual hosts return a custom 404 page.
This 404 / html page has an image it loads as the background, so in the Apache root directory (/var/www) I have: 404.html [images]\404-background.jpg
I've tried so many iterations (and continue to while hoping for help) that I'm not going to list them all here. I'd like to do this within the config files and not .htaccess files.
Can someone point me in the right direction please? I apologize for the similar questions but they seem to refer to previous versions of Ubuntu / Apache (for example the new default .conf extension)
I have edited /etc/apache2/conf-enabled/localized-error-pages.conf with
ErrorDocument 404 /404.html
The 404 works on the default but not in the virtualhost. I'm likely missing an directive in the VH config file.
The issue stems from the VH referencing its own DocumentRoot. In the HTML of the 404.html page I have:
<div id="background">
<img src="images/404-background.jpg" class="stretch" alt="404 - Page not found." >
</div>
If I try an Alias approach I can get the 404.html page to load but the image reference doesn't work (because it is looking at the VH as the base)
Example VH.conf that won't reference the image:
Alias "/error" "/var/www/"
ErrorDocument 404 /error/404.html
I've tried approaching this from
/etc/apache2/conf-available/localized-error-pages.conf
which is probably what it will take but haven't yet sorted it.
Many thanks.