Welcome to WebmasterWorld Guest from 220.127.116.11
Now, you rewrite www.domainA.com to /toplevel/domainA, however, index.html uses relative URL's like this:
My question is this: Can a rewrite be done so that the above rewrite can access the hierarchy above it even though the rewriteengine always rewrites domainA.com to that particular subdirectory?
Remember that the relative URL is a URL, not a filesystem path. When a relative URL is resolved to a canonical URL, it is the base URL that is used, not a server filepath.
So the answer is that using "../image" in your index file at [domain.com...] is not going to work, because you can't access a resource above your web root URL. But, since you don't need to, it doesn't matter.
I hope this is clear! Just remember that using mod_rewrite, YOU can make the rules of how URLs are mapped to the file system.
Here is the problem:
You want a site that can be accessed one of two ways:
Both written to the same subdirectory however in the case of B) you can get away with relative URL's to the path above, with A) seems impossible.
So the solution is: use absolutes?
You don't have to do anything except use a transparent redirect from domainA/ to domainB/domainA/ and write all your links, relative or absolute, as if you are really in a separate, real domainA/ ... Since the redirect is always applied regardless of whether the link is relative or absolute, you don't have worry about anything. All requests for domainA/<anything> will get redirected to domainB/domainA/<anything>.
Now, if you want to have "shared" hosted images in domainB, which is above domainB/domainA, then what you'll need to do is to refer to those images as if they actually exist in domainA/ and then *not* redirect those requests so that they access files which are actually hosted in the root domainB directory. In order to keep this simple, I'd suggest a separate subdirectory of domainB to be used for these shared images.
As long as you are using transparent (internal) redirects. This ought to work just fine.