lucy24 - 12:33 pm on Sep 2, 2013 (gmt 0)
With that i only get the redirection to work
Darn that mod_rewrite. It insists on doing what you tell it to do, instead of what you want it to do.
[R] flag = redirect. Temporary 302 redirect to be exact. Even without the flag, anything using a full protocol-plus-domain will be a redirect unless you explicitly tell it not to.
If everything lives on the same server it should all work nicely with the [P] flag.
Watch out for that leading .* At a minimum you'd want .+ because otherwise you're allowing for hostnames with leading . Here you probably want \w+ or, if your server prefers, [^.]+
RewriteRule /(.*) http:/ /www.domain.com/app-%1
The %1 came from the subdomain in the last RewriteCond. But what happened to the path of the URL? You captured it, as one would expect, but where does it go?