I did that already - look for the colored text above.
The RewriteEngine off/on commands are similar to /* */ in PHP and Javascript. It’s a good practice to use the RewriteEngine on before your mod_rewrite code, too.
The only problem that I see is the use of = in your second RewriteCond - that’s what matching does so your = is inappropriate.
RewriteCond %{HTTP_HOST} ^([^.]+)\\.example\\.com$ [NC]
# be sure that you're looking at the {HTTP_HOST} case Insensitively
[COLOR="Blue"]RewriteCond %1 !www$[/COLOR]
# that's how to check for an exact match!
RewriteRule ^company/([^./]+)\\.html$ [COLOR="Red"]/[/COLOR]company/$1.php?user=%1 [L]
# that / leading the redirect can get confused as the physical root
# - don't use it if you don't need it!
The first thing you need to do is create the subdomains (Dynamically configured mass virtual hosting) as they ALL act like different domains (and are treated that way by your DNS as well as Apache). Your host can allow/disallow that so check with them before you run off in this chase.
Second, which way are you redirecting? That’s a common problem with “newbies” as they want to redirect from something that can be served by Apache to something which does not exist. In other words, are you redirecting from the subdomain to the REAL link in the maindomain’s folder subdirectory (so long as the wildcard subdomains share the main domain’s DocumentRoot, this is not a problem)? Just remember that YOU must create the links the way that you want them seen THEN create the mod_rewrite code to redirect to the file that Apache can serve your visitor.
Okay, the rest of that looked like a “script kiddie” request so let me point you in the right direction (we do NOT do free coding here - we TEACH and ensure that you understand what YOUR code is doing).
First, you can read all about mod_rewrite in the link in my signature and the sticky threads (hmmm ).
Second, you will HAVE to use a RewriteCond statement to examine the {HTTP_HOST} Apache variable to capture the subdomain’s value. Then it is a simple matter to (internally) redirect to the folder with the URI intact (or utilizing the subdomain value).
Please remember that we are here to help you learn and will ensure that you understand what your code is doing.