Can you really redirect all demands to x.domain.com/.* to y.domain.com/.* WITHOUT letting this redirection be visible within the url?
I've unsuccessfully attempted a number of things inshtaccess. Just indicating the [L] flag still shows this redirection within the url (because it does after i make use of the [R] flag furthermore).
EDIT: as somebody stated there being pointless with this, allow me to give more information :) I've one nice url: x.domain.com , which established fact. Then you will find many other domain names: spring.domain.com , summer time.domain.com , fall.domain.com, winter.domain.com . With respect to the season, a particular y.domain.com becomes the present one. The x.domain.com must always map to the present one.
EDIT2: I'll write here, because the code is not nicely made within the comments... I attempted what Arjan recommended:
RewriteCond % ^x.domain.com$ RewriteRule ^(.*)$ /path/to/y.domain.folder/$1
Unfortunatly though this prevents redirecting forever. :(
Request exceeded the limit of 10 internal redirects because of probable configuration error. Use 'LimitInternalRecursion' to improve the limit if required. Use 'LogLevel debug' to obtain a backtrace.
Putting the [R] flag behind, I see within the url something similar to:
Now will be able to browse the errorlogs, I'm able to provide a direct response, as such a possible 500 error describes.
Perhaps you have attempted Alias /dir/file.html /full/path/to/other/file.html ??
If these aren't located on a single server, then you'd require the Proxy flag. This necessitates the proxy module to become running. Not examined:
RewriteCond % ^x.domain.com$ RewriteRule ^(.*)$ http://y.domain.com/$1 [P]
EDIT: Because of the edits for your question they are most likely just on a single server. So then indeed, as jetru recommended an Alias might do. Or:
# No RewriteCond needed serve all content using their company folder: RewriteRule ^(.*)$ /path/to/y.domain.folder/$1
EDIT: The above mentioned wouldn't alter the HTTP_HOST header which was sent through the browser (maybe that you can do too). This suggests it would only work when the subdomains are symbolized around the file system separate sites. So, because the
.htaccess would then go within the directory holding the web site for x.domain.com, the
RewriteCond wouldn't be also needed. Also, your directory with this x.domain.com subdomain would actually not require any HTML content then ultimately all content could be offered in the directory of some other subdomain.
EDIT: Because the above doesn't appear to operate either, and yields endless rewrite loops even if adding [NS], maybe simply adding [L] helps here:
RewriteRule ^(.*)$ /path/to/y.domain.folder/$1 [NS,L]
Or possibly it's possible to set an atmosphere variable to prevent the loop:
RewriteCond % !=1 RewriteRule ^(.*)$ /path/to/y.domain.folder/$1 [E=MY_VAR:1]
But, for [L] and [E]: I am just speculating I have never made
mod_rewrite jump in to the directory of some other virtual host. I don't know it is possible to begin with.
Regrettably, it's unclear how you might give a new subdomain. If a person would simply need to produce a new directory using the title from the subdomain (with no utilization of some administrative tool) then your provider may be be utilising system wide spinning too. Actually, even without subdomains the provider may be doing a bit of Mass Virtual Hosting as referred to within the URL Rewrite Guide.
I suppose the very best solution is always to change the need for HTTP_HOST quickly, to resolve difficulties with any system wide spinning. Maybe this is permitted to accomplish this:
RewriteCond % ^x.domain.com$ RewriteRule ^(.*)$ /path/to/y.domain.folder/$1 [E=HTTP_HOST:y.domain.com]
Again, because the above would only trouble the
.htaccess within the x.domain.folder, the
RewriteCond is most likely unnecessary whatsoever.