I have a domain with a subdomain set up like the following in my vhost.conf file.
<VirtualHost *:80> ServerName mysite.com ServerAlias www.mysite.com DocumentRoot /opt/mysite/webapps/ROOT/ ProxyPassMatch / ajp://localhost:8084 </VirtualHost> <VirtualHost *:80> ServerName subdomain.mysite.com ServerAlias www.subdomain.mysite.com DocumentRoot /opt/mysite/webapps/ROOT/ Redirect /index.jsp /index2.jsp ProxyPassMatch / ajp://localhost:8084 </VirtualHost>
The main site loads
index.jsp but I would like the subdomain to load up a different JSP file (
I've tried using Redirect but it just goes to
index.jsp on the subdomain.
The following is wrong due to the presence of
It's been ages since I last configured an Apache VirtualHost, but I think
is what you're looking for.
So, the complete config would be:
<VirtualHost *:80> ServerName subdomain.mysite.com ServerAlias www.subdomain.mysite.com DocumentRoot /opt/mysite/webapps/ROOT/ # Serve index2.jsp as index file DirectoryIndex index2.jsp ProxyPassMatch / ajp://localhost:8084 </VirtualHost>
I didn't look hard enough, looks like the
ProxyPassMatch directive overrides a lots of other commands:
As the ProxyPassMatch directive is evaluated as the very beginning of each request: -AddType (for MultiView) or DirectoryIndex directives are not usable -right management per directory is not available -each Alias directive needs another proxy rule
The problem is that your
index2.jsp will never be served by Apache as the server's already matched the ProxyPass /, and so it's already been passed to
You should then manage serving