サイトのルートを指す 2 つのドメインがあります。
http://site1.com
http://site2.com
both point to http://dXXXXXXX.domain.com/
サブディレクトリ(同じ名前)でファイルを検索するように各サイトを設定しているので、
http://site1.com files are located in http://dXXXXXXX.domain.com/site1/
http://site2.com files are located in http://dXXXXXXX.domain.com/site2/
メイン ディレクトリ (両方のドメインが共有できるフォーラム) 内のフォルダーを実際に指す、site1 (および場合によっては site2) 用の特別なサブドメインを作成したいと考えています。次のように、実際の URL をサブドメイン URL でマスクしたいと思います。
http://subdomain.site1.com masks http://dXXXXXXX.domain.com/shared_folder/ (not redirected)
私の .htaccess ファイル (最上位ディレクトリにある) は次のようになります。
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]
また、可能であれば、次のように、各ドメインへの絶対パスを優先パスにリダイレクトしたいと思います。
http://dXXXXXXX.domain.com/site1/ redirects to http://site1.com
http://dXXXXXXX.domain.com/site2/ redirects to http://site2.com
誰かがそれらのリンクを見つけるかどうかはわかりませんが、同じコンテンツに対して複数のアクセス ポイントを持たないようにして、すべてをきれいに保ちたいと思います (意図的に共有された css またはフォーラム ソフトウェアを除く)。
あなたが私のために持っているかもしれない助けや洞察を前もって感謝します