Only the vvvvvv.org has the original IP adress the rest are routed to vvvvvv.org later. I want to redirect the yyyyyy.com and zzzzzz.com addresses to their respective directories under vvvvvv.org which are vvvvvv.org/yyydir and vvvvvv.org/zzzdir. I am on a rented webhosting and do not have access to httpd.conf. I have to do it with .htaccess The host is running Apache 1.3.41

I want www.vvvvvv.org appear as itself no matter what you enter vvvvvv.org or www.vvvvvv.org I want www.vvvvvv.org/yyydir appear as www.yyyyyy.com no metter what you enter yyyyyy.com or www.yyyyyy.org I wanr www.vvvvvv.org/zzzdir appear as www.zzzzzz.com no metter what you enter zzzzzz.com or www.zzzzzz.org

By no means I am no expert on either programming nor scripting like this. However, so far I have read a lot and came up with the following:

Sadly, it's not doing what I am intended. When I write yyyyyy.com it goes to www.vvvvvv.org. When I write www.yyyyyy.com it goes to www.vvvvvv.org/yyydir as intended but the adress bar of the browser shows it as www.vvvvvv.org/yyydir not www.yyyyyy.com

Use the "internal rewrite" syntax of mod_rewrite, not the "external redirect" syntax. By definition, an external redirect "tells" the client (browser or robot) to ask for the content again at a new URL, so the client browser will update it's address bar, and search engines will update the URL in their index database.

Also, you should place you external redirects first, in order from most-specific pattern (least URLs affected) to least-specific pattern, followed by internal rewrites, again in order from most-specific to least-specific pattern.

Do not accept mixed-case hostnames or hostnames with an appended FQDN indicator (a trailing period) or port number; Redirect them to the canonical domain.

It is not clear what some of the "special conditions" in your code are for, so I can't quite figure out exactly what you intended to do. Code comments are something that I highly recommend, both to make your code clear when posted in forums, and to remind you of what the code is intended to do when you look at it again in six months (or after six years).

In order to simplify the code and make future growth easier, it's often a good idea to put the alternate domains into a separate "hosted sites" subdirectory or to "tag" the filepath in some other obvious way. This keeps the top-level directory simple and tidy, but more importantly, allows you to recognize a previously-rewritten path so that you don't rewrite it again... avoiding recursion. In the code below, I show code that assumes that files for "www.foo.com" are stored in the subdirectory "/vh_www.foo.com/". The rewriterule looks at the current URL-path and won't rewrite it if it already starts with "vh_". This easily avoids the recursion problem that you would have otherwise. You can use any subdirectory name or prefix you like, I just picked "vh_" for "virtual hosts."

You may also want to add exceptions to the domain-to-subdirectory rewrite rule; I removed your exception for the robots.txt file because each domain should have its own robots.txt file, but you may want to add exceptions for shared image or script directory requests, etc. which should not be rewritten to the domain-subdirectory.