I have a subdomain images.example.com, which, as the name suggests, delivers images to all of the other subdomains on example.com.
At the moment, I have set up the virtual host to apply all custom error documents from the parent domain like so:
ErrorDocument 400 http://www.example.com/errors/400/
ErrorDocument 401 http://www.example.com/errors/401/
ErrorDocument 403 http://www.example.com/errors/403/
ErrorDocument 404 http://www.example.com/errors/404/
ErrorDocument 500 http://www.example.com/errors/500/
ErrorDocument 405 http://www.example.com/errors/405/
// And so on...
However, what I would like to do is redirect the visitor if they do not specify any file or directory. In other words, if they go to images.example.com, they will be redirected to www.example.com.
Example:
images.example.com will redirect to www.example.com
but
images.example.com/directory/ will not redirect
The reason why I only want to redirect the first page is simply because, if you do not specify a document/directory, it shows the default Apache Server Test page instead of showing an error page.
So, in short, how can I redirect a domain only if no file/directory has been specified in the URL?
Or, how can I prevent the default Apache Server Test page from showing when no file/directory has been specified?
Last Resort
If I am unable to achieve this using my .htaccess, then I will just add a php page to teh root directory or the images subdomain and then just redirect from there...
Further Information
I have read elsewhere that by specifying a 403 error document, then the Apache Server Test page will not be shown. Well this has not worked as I have specified the error and I am still seeing the test page...