How to redirect from one port to another?

view full story

http://serverfault.com – I've a domain on which I'm running two different web applications at different ports. A Java web application on example:8888/foo A PHP website on example:8080/bar The requirement is, if an user tries to access the root of example:8888 or example:8080, then the user should be redirected to example:8888/foo. How can I achieve this requirement? (HowTos)