welcome to WebmasterWorld, gx2000!
with no success
you should be more specific about what request you made, what result you expected, and what response you got.
RewriteEngine on
RewriteRule ^dispatch/(.*)$ [app.example.com...] [R=301,L]
you should either capture the slash after "dispatch" or provide one in the Substitution string.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^company\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.company\.com$
RewriteRule ^dispatch\/(.*)$ "https\:\/\/app\.company\.com\/dispatch$1" [R=301,L]
don't use quotes in the Substitution string and it's not a regular expression so don't escape anything with backslashes.
there's also no need to escape the forward slash with backslash in the Pattern.
see above about providing a slash in the Substitution string.
regarding your OR'ed conditions, i would suggest this:
RewriteCond %{HTTP_HOST} !^(app\.example\.com)?$
the reason for using the ( ) ? in the RewriteCond is to avoid an infinite redirect loop for HTTP/1.0 user agents which don't send a Host: HTTP Request header.
RewriteEngine on
#RewriteCond %{HTTP_HOST} ^app\.company\.com\dispatch$
#RewriteCond %{REQUEST_URI} !^app/
#RewriteRule ^(.*)$ /app/$1 [L,QSA]
(assuming you tried this without comments)
not sure what you're trying to do here.
guessing maybe looking for the canonical hostname before doing an internal rewrite?
you should order your rules so a hostname canonicalization redirect occurs before an internal rewrite in which case you wouldn't need that RewriteCond.
in any case, HTTP_HOST would not include any part of the path.
REQUEST_URI would include all path information so a start-anchored Pattern should have a leading slash.
the QSA flag would only be necessary if you had a query string in the Substitution string and you wanted to append the requested query string.
by default the query string is appended unless you provide a replacement.
also, in this forum,
Please Use Example.com For Domain Names in Posts:
http://www.webmasterworld.com/apache/4452736.htm [webmasterworld.com]