I am running my website(www.example.com) using IIS server. Now my requirement is to run website (www.example.com) from Apache Server for PHP and www.example.com/XYZ url from IIS server for ASP .NET.
is this routing possible?
Do you mean on the same Windows Server? On port 80?
I think it's not possible to run two services on one port. The server has to process an incoming request on port 80 before deciding which service it is routed to, and then each service has to accept the request before resolving the domain name. The server and services and no way of knowing which process the request is meant for before it's too late.
If you don't mind running one of the web services on a non-standard port, it should work. Have you tried?
You can use the reverse proxy function on apache.
a2enmod proxy proxy_http
and then route /XYZ to the IIS server (or IIS port) in the apache config
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ProxyPass /XYZ http://old.iis.server/
ProxyPassReverse /XYZ http://old.iis.server/
</VirtualHost>
restart apache and it should work fine.
Edit: If it has to be on the same physical machine, IIS must be "moved" to another port. Both services can't bind to port 80(HTTP)/443(HTTPS). This is simply impossible. One port - one service. So, change the port of the IIS-Server to e.g. 8080 (HTTP) and 8443 (HTTPS) and use
ProxyPass /XYZ http://localhost:8080/
ProxyPassReverse /XYZ http://localhost:8080/