File robots.txt là gì?
Mục đích sử dụng file robots.txt để làm gì?
Cấu trúc file robots.txt gồm những gì?
File robots.txt chuẩn cho website WordPress
| User-agent: * | Chỉ định rằng các quy tắc dưới đây áp dụng cho tất cả các bot của công cụ tìm kiếm (Googlebot, Bingbot, v.v.). |
| Disallow: /wp-admin/ | Chặn quyền truy cập vào thư mục quan trọng |
| Disallow: /wp-admin/ Allow: /wp-admin/admin-ajax.php | Chặn bot truy cập vào thư mục /wp-admin/ nhưng cho phép truy cập vào admin-ajax.php (cần thiết cho một số plugin hoạt động đúng). |
| Disallow: /wp-includes/ | Chặn thư mục hệ thống WordPress /wp-includes/ chứa các file hệ thống không cần lập chỉ mục. |
| Disallow: /xmlrpc.php | Chặn /xmlrpc.php là API từ xa, dễ bị tấn công DDoS nên chặn |
| Disallow: /?s= Disallow: /search/ | Chặn trang tìm kiếm nội bộ (/?s= hoặc /search/) |
| Disallow: /feed/ | Chặn tránh index để tối ưu crawl budget. Nếu sử dụng Google News thì không nên chặn |
| Disallow: /comments/ | Chặn index để tối ưu crawl budget |
| Disallow: /trackback/ | Chặn index để tối ưu crawl budget |
| Disallow: /xmlrpc.php | Chặn index để tối ưu crawl budget |
| Disallow: /tag/ | Chặn thẻ để tránh trùng lặp nội dung. Nếu SEO tag thì không nên chặn |
| Disallow: /archives/ | Chặn lưu trữ để tránh trùng lặp nội dung |
| Sitemap: https://example.com/sitemap.xml | Khai báo Sitemap để chỉ định đường dẫn sitemap giúp bot tìm thấy nội dung nhanh hơn. |
| Disallow: /wp-json/ | Chặn WordPress REST API không cần index để bảo mật. Tuy nhiên /wp-json/ chứa API REST của WordPress, có thể quan trọng với các plugin(WooCommerce) hoặc tính năng website |
| Disallow: /wp-content/plugins/ Disallow: /wp-content/themes/ Allow: /wp-content/plugins/.css Allow: /wp-content/plugins/.js Allow: /wp-content/themes/.css Allow: /wp-content/themes/.js | Chặn ác thư mục theme/plugin quan trọng của WordPress nhưng vẫn cho phép truy cập tài nguyên tĩnh (JS, CSS) để Google hiển thị bình thường |
| Sitemap: https://example.com/sitemap.xml | Khai báo Sitemap để chỉ định đường dẫn sitemap giúp bot tìm thấy nội dung nhanh hơn. |
User-agent: *
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/themes/
Disallow: /cgi-bin/
Disallow: /?s=
Disallow: /?s=
Disallow: /search/
Disallow: /xmlrpc.php
Disallow: /wp-json/
Disallow: /feed/ Disallow: /comments/ Disallow: //feed/
Disallow: /*/trackback/
User-agent: *
Disallow: /wp-admin/
Disallow: /wp-login.php*
Disallow: /?s=
Disallow: /search
Disallow: /attachment*
Disallow: /refer
Disallow: /tag/
Disallow: /xmlrpc.php*
Disallow: /readme.html
Disallow: /component
Disallow: /wp-includes/
Disallow: /plugins/
Disallow: /themes/
Sitemap: https://timhoa.com/sitemap_index.xml
Sitemap: https://timhoa.com/category-sitemap.xml
Sitemap: https://timhoa.com/post-sitemap.xml
Sitemap: https://timhoa.com/page-sitemap.xml
Sitemap: https://timhoa.com/product_cat-sitemap.xml
Sitemap: https://timhoa.com/product-sitemap.xml
Sitemap: https://timhoa.com/store-sitemap.xml
User-agent: *
Disallow: /wp-admin/
Disallow: /wp-login.php
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/themes/
Disallow: /cgi-bin/
Disallow: /?s=
Disallow: /*?s=
Disallow: /search/
Disallow: /xmlrpc.php
Disallow: /wp-json/
Disallow: /feed/
Disallow: /comments/
Disallow: /*/feed/
Disallow: /*/trackback/
Disallow: /author/
Disallow: /search/
Disallow: /tag/
Allow: /wp-admin/admin-ajax.php
Allow: /wp-content/uploads/
# Sơ đồ website
Sitemap: https://timhoa.com/sitemap_index.xml
Sitemap: https://timhoa.com/category-sitemap.xml
Sitemap: https://timhoa.com/post-sitemap.xml
Sitemap: https://timhoa.com/page-sitemap.xml
Sitemap: https://timhoa.com/product_cat-sitemap.xml
Sitemap: https://timhoa.com/product-sitemap.xml
Sitemap: https://timhoa.com/store-sitemap.xmlThông tin bài viết:
ĐỖ QUỐC HỮU
Digital Marketer
Đỗ Quốc Hữu là một Digital Marketer đa nhiệm có năng lực tự mình triển khai toàn bộ dự án marketing online vừa và nhỏ nhờ khả năng thiết kế website, sáng tạo nội dung, quảng cáo online, seo, tổ chức sự kiện…