I have 2 domains pointing to the root of my site:
http://site1.com
http://site2.com
both point to http://dXXXXXXX.domain.com/
I have each site set up to look for its files in a subdirectory (of the same name) so
http://site1.com files are located in http://dXXXXXXX.domain.com/site1/
http://site2.com files are located in http://dXXXXXXX.domain.com/site2/
I would like to create a special subdomain for site1 (and possibly site2) that actually points to a folder in the main directory (a forum that both domains can share). I would like to mask the real url with the subdomain url like the following:
http://subdomain.site1.com masks http://dXXXXXXX.domain.com/shared_folder/ (not redirected)
my .htaccess file (in the topmost directory) looks like this:
Options +FollowSymLinks
RewriteEngine On
# Rewrite "www.domain.com -> domain.com"
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
# redirect site1.com to /site1 [folder]
# redirect site2.com to /site2 [folder]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^([^0-9]+)$ [NC]
RewriteRule ^(.*)$ /%1/$1 [QSA,L]
#i think this should work but it doesn't
#RewriteCond %{HTTP_HOST} ^subdomain\.site1\.com$ [NC]
#RewriteRule ^$ shared_folder [P]
also, if possible, I would like to redirect the absolute path to each domain to my preferred path as follows:
http://dXXXXXXX.domain.com/site1/ redirects to http://site1.com
http://dXXXXXXX.domain.com/site2/ redirects to http://site2.com
not sure that anyone would ever find those links, but I'd like to keep everything clean by not having multiple access points for the same piece of content (with the exception of intentionally shared css or forum software)
Thanks in advance for any help or insight you may have for me