0
对于我的子域,我想指向一个不同的robots.txt文件。我希望下面的代码将工作:请帮我理解子域robots.txt的简单nginx重写问题
if ($host ~ subdomain) {
rewrite ^/favicon.ico$ /favicon.ico break;
rewrite ^/robots.txt$ /robots.subdomain.txt break;
rewrite ^/([^\/]*)?/?(.*)?$ /index.php?in1=$1&in2=$2&$query_string last;
}
favicon.ico的正常工作,所有其他扩展改写到index.php就好了,但这样是robots.txt的。
我花了很多时间试图解决它,我通过在robots.txt重写后添加以下行来做到这一点。
rewrite ^/robots.subdomain.txt$ /robots.subdomain.txt break;
是否有人可以帮助我,为什么它只有当我加入这行,如果你还看不到任何明显的低效到我的配置任何改进将受到欢迎的作品!谢谢。