hmm.... I'd need more details to understand exactly what you're trying to accomplish, but if it's just for web redirects you could do something like this:
Assuming you have access to a conf.d directory for apache and a hosted server with a static IP and Name.
You can have your remote servers call the static server when their IP address changes. If they call a php script with the URL they serve, you could update a passthru proxy configuration on apache. When the static apache server sees a request coming it, redirects to the remote Server.
Sample proxy.conf:
<VirtualHost *>
DocumentRoot /www/docs/host.foo.com
ServerName host.foo.com
ServerAlias host
ProxyPass / http://10.10.123.10/
ProxyPassReverse / http://10.10.123.10/
</VirtualHost>
This should allow you to point all of your domains (
www.ex1.com,
www.ex2.com) to the same IP as your static server and have it re-route traffic to the dynamic ip servers based on name.
If you want to use just 1 domain name and re-route based on directory, you could do the same, you would just have multiple proxypass lines for the 1 server and list each directory.
When an IP address changed, your php script would modify the proxy.conf file and send a reload command to apache. kill -HUP `cat /var/run/apache.pid` or whatever.
It could work. DynDNS is much easier.