Tạo Robots.Txt cho nhiều tên miền
Hiên nay nhiều công ty hay doanh nghiệp thường mua nhiều domain cho
website của họ. Nhưng theo nguyên tắc SEO thì, nhiều domain cho cùng 1
website nghĩa là trùng lập nội dung -> Chết.
Bay giờ ta VD như sau!: Ta có 3 tên miền là: abc.com, def.com và xzy.com, 3 domain này cùng 1 hosting, nếu ta chọn abc.com làm domain chính và không muốn google bot index url từ 2 domain def.com và xzy.com thì ta làm như sau:
robots_abc.txt <– file robots.txt cho tên miền abc.com
robots_def.txt <– file robots.txt cho tên miền def.com
robots_xyz.txt <– file robots.txt cho tên miền xyz.com
Sau đó tạo 1 file .htaccess
Vậy là google bot chỉ index domain abc.com mà k index 2 domain còn lại! để tránh tình trạng trùng lập nội dung
Bay giờ ta VD như sau!: Ta có 3 tên miền là: abc.com, def.com và xzy.com, 3 domain này cùng 1 hosting, nếu ta chọn abc.com làm domain chính và không muốn google bot index url từ 2 domain def.com và xzy.com thì ta làm như sau:
robots_abc.txt <– file robots.txt cho tên miền abc.com
User-agent: *
Disallow: /administrator/
Disallow: /cache/
Disallow: /components/
Disallow: /images/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /libraries/
Disallow: /administrator/
Disallow: /cache/
Disallow: /components/
Disallow: /images/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /libraries/
User-agent: *
Disallow: /
Disallow: /
User-agent: *
Disallow: /
Disallow: /
RewriteCond %{HTTP_HOST} ^abc.com$ [NC]
RewriteRule ^robots\.txt$ robots_abc.txt [L]
RewriteCond %{HTTP_HOST} ^def.com$ [NC]
RewriteRule ^robots\.txt$ robots_def.txt [L]
RewriteCond %{HTTP_HOST} ^xzy.com$ [NC]
RewriteRule ^robots\.txt$ robots_xzy.txt [L]
RewriteRule ^robots\.txt$ robots_abc.txt [L]
RewriteCond %{HTTP_HOST} ^def.com$ [NC]
RewriteRule ^robots\.txt$ robots_def.txt [L]
RewriteCond %{HTTP_HOST} ^xzy.com$ [NC]
RewriteRule ^robots\.txt$ robots_xzy.txt [L]
Vậy là google bot chỉ index domain abc.com mà k index 2 domain còn lại! để tránh tình trạng trùng lập nội dung
Nhận xét
Đăng nhận xét