To create a "www" alias for an app in a given ORG and SPACE, follow these steps:
1. Login to cf and target the org and space:
cf login
cf target -o ORG -s SPACE
2. Create a subdomain with the same name or route as the app:
cf create-domain ORG app.domain.com
cf create-route SPACE app.domain.com
3. Create a route with the
-n (hostname) option, pointing to www.app.sampledomain.com:
cf create-route SPACE app.domain.com -n www