Forum Moderators: phranque
domain.com to test01.domain.com transparently so that the users address bar remains listed as domain.com
I have searched the forums and read numerous other posts without coming up with the answer. I'm sure a big part of the problem is my inexperience, so I appreciate all the help and support.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule ^(.*)$ [test01.domain.com...] [R=301,L]
What you need is a "rewrite".
One of those omits the domain name and the R=301 bit at the very least.
The target will be an internal filepath on the server, not a new URL.
The difference between a redirect and a rewrite, and between a URL used out on the web and a filepath used inside the server, is also crucial.
If the files for 'test01' are stored in a subdirectory below the 'main directory' for "example.com", then it's a simple matter of adding that subdirectory path to the requested path (while preventing a loop). For example, if the resources for example.com are stored in the server filespace at /var/www/html/example/ and the resources for test01.example.com are stored in the server filespace at /var/www/html/example/test01/ then something like this will likely work:
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteCond $1 !^site01/
RewriteRule ^(.*)$ /site01/$1 [L]
Jim