mm,
First and foremost, WELCOME to SitePoint!
Then, please allow me to add to your list of mod_rewrite tutorials: You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It's helped may members and should help you, too.
Finally, it would appear that the Apache variable you're looking for is {SERVER_PORT} to enable you to distinguish what port is being used/requested.
As for your code (PLEASE wrap your code in [code]...[/code] tags as that preserves the code when quoting for a reply):
Code:
RewriteCond %{HTTP_HOST} ^subdomainthree\.example\.com [NC]
# Don't forget to escape the dot characters in your regular expressions!
RewriteRule ^/(.*) http://subdomainone.example.com:8010/$1 [L,R,proxy]
# The leading / after the ^ infers (DEMANDS) use of Apache 1.x and there are very few left "in the wild"
# It will NOT be matched by Apache 2.x!
# If you're not sure (as a sysadmin!?!), use ^/? but use the correct code for the server if you can!
# Since ^(.*)$ already exists as {REQUEST_URI}, use RewriteRule .? http://subdomainone.example.com:8010%{REQUEST_URI}
# because it also resolves your ^/? issue painlessly.
# proxy?
# Apache.org: Use this flag to achieve a more powerful implementation of the ProxyPass directive, to map remote content into the namespace of the local server.
# Apache.org: Use of the [proxy|P] flag implies [L] - that is, the request is immediately pushed through the proxy, and any following rules will not be considered.
# Apache.org: Note: mod_proxy must be enabled in order to use this flag.
RewriteCond %{HTTP_HOST} ^subdomainthree.example.com [NC]
RewriteRule ^/(.*) http://subdomaintwo.example.com:8092/subdomainthree [L,R,proxy].example.com/subdomainthree [NC]
# No case in a RewriteRule (for {REQUEST_URI}) is just dead wrong! Remember, {REQUEST_URI} IS case sensitive!
RewriteRule ^/docking/(.*) http://subdomaintwo.example.com:8092/subdomainthree/$1 [L,R,proxy]
# What domain does this apply to? Hint: It does not use the above RewriteCond statement (which belongs to the RewriteRule above).
RewriteCond %{HTTP_HOST} ^subdomainthree.example.com [NC]
RewriteRule ^/(.*) http://subdomaintwo.example.com:8092/subdomainthree [L,R,proxy]
[standard rant #1]The use of "lazy regex," specifically the

EVERYTHING

atom, (.*), and its close relatives, is the NUMBER ONE coding error of newbies BECAUSE it is "greedy." Unless you provide an "exit" from your redirection, you will ALWAYS end up in a loop!
[/standard rant #1]
Hmmm, no examination of the {SERVER_PORT} so, apparently, you're not checking on the domain in use via the port requested. Your explanation was probably pretty exact (domains and ports going every which way) but I concentrated on your mod_rewrite review request this post.
Please remember that showing only a portion will leave conflicts untouched if they exist outside what you've shown.
Regards,
DK
Bookmarks