这取决于你如何拥有2域设置和你的主机。在不知道任何细节的情况下完成此操作的一种直接方法是使用内部代理将其指向另一个,方法是将其放入其他域的文件(其中放置files.abc.com):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^files\.abc\.com$ [NC]
RewriteRule ^(.*)$ http://files.123.com/$1 [P,L]
在这里,我们有文件坐在主机files.123.com
,这意味着我们可以去http://files.123.com/some/file.txt。但有了这个规则,你可以去http://files.abc.com/some/file.txt,它会内部代理到123.com主机。
如果两者域指向同一个主机,并说,你要么规则或子域的cPanel用于设置123.com:
RewriteCond %{HTTP_HOST} ^files\.123\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /here-are-where-123.com-files-really-are/$1 [L]
或者在一些的cPanel相当于设置。无论哪种方式,请求files.123.com
由目录/here-are-where-123.com-files-really-are/
服务。您只需包含一组规则以适应其他文件域,然后将它们放在文档根目录中的.htaccess文件中:
RewriteCond %{HTTP_HOST} ^files\.abc\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /here-are-where-123.com-files-really-are/$1 [L]