.htaccess 是否从主域上的子域访问robots.txt文件?

.htaccess 是否从主域上的子域访问robots.txt文件?,.htaccess,redirect,subdomain,.htaccess,Redirect,Subdomain,我使用codeigniter和位于根目录中的robots.txt文件,但它只能从主域访问。搜索机器人试图从子域访问它(我将其用于区域设置): 例如: my.com/robots.txt - OK en.my.com/robots.txt - FAIL 如何从xx.my.com/robots.txt重定向到my.com/robots.txt? 谢谢。尝试使用重定向匹配 RedirectMatch 301 /robots.txt http://my.com/robots.txt

我使用codeigniter和位于根目录中的robots.txt文件,但它只能从主域访问。搜索机器人试图从子域访问它(我将其用于区域设置): 例如:

my.com/robots.txt - OK
en.my.com/robots.txt - FAIL
如何从xx.my.com/robots.txt重定向到my.com/robots.txt?
谢谢。

尝试使用
重定向匹配

RedirectMatch 301 /robots.txt http://my.com/robots.txt