Chuyển đến nội dung chính

Robots.txt là gì ? Cách sử dụng robots.txt

1.Robots.txt là gì ?Robots.txt là một dạng text đặc biệt không phải là HTML hay một loại nào khác. Nó giúp cho các webmaster linh hoạt hơn trong việc cho hay không cho bot của các công cụ tìm kiếm(SE) đánh chỉ mục(index) một khu vực nào đó trong website của bạn.
Ví dụ:
User-agent: *
Disallow: /wp-admin/
Disallow: /wp-includes/
chú giải :
  • User-agent: * : cho phép tất cả các loại bot
  • Disallow: /wp-admin/  : chặn thư mục wp-admin và tất cả những gì nằm trong thư mục wp-admin
2.Hướng dẫn sử dụng Robots.txt
a.Khóa toàn bộ website không cho bot đánh chỉ mục
User-agent: *
Disallow: /
==> có nghĩa là cấm tất cả các loại bot truy cập vào tất cả tài nguyên có trên website của bạn, như vậy có nghĩa là website bạn chả thèm chơi với các SE
b.Không cho phép bot truy cập vào thư mục nào mà mình không muốn
Lấy lại ví dụ trên :
User-agent: *
Disallow: /wp-admin/
Disallow: /wp-includes/
==> Diều này có nghĩa là cho phép tất cả các loại bot thu thập chỉ trừ 2 thư mục wp-admin và wp-includes
c.Chặn 1 trang
Disallow: /lien-he.html
d.Loại bỏ 1 hình từ  Google Images
User-agent: Googlebot-Image
Disallow: /images/hinh.png
e.Chặn một bot nào đó
User-agent: SpamBot
Disallow: /

User-agent: *
Disallow: /wp-admin/
Disallow: /wp-includes/
==> Để bắt đầu chỉ định mới thì bạn hãy đặt một dòng trắng. Và bot SpamBot bị cấm truy cập tất cả tài nguyên. Trong khi các bot khác  được truy cập tất cả trừ thư mục “wp-admin ” và "wp-includes"
User-agent: SpamBot
Disallow: /admin/
Disallow: /includes/
Disallow: /config/config.php

User-agent: *
Disallow: /admin/
Disallow: /includes/
==> Không cho phép SpamBot truy cập các thư mục được liệt kê như: thư mục “admin”, “includes” và và file “config.php” . Còn các bot khác được truy cập mọi thứ trừ hai thư mục “admin” và “includes”.
f.sử dụng đồng thời “Allow” và “Disallow” cùng nhau
User-agent: Googlebot
Disallow: /vidu/
Allow: /vidu/demo-thoi-nha.html
== > có nghĩa là chặn Googlebot truy cập vào tài nguyên có trong thư mục "vidu"  .Nhưng chỉ có thể truy cập được file "demo-thoi-nha.html"
User-agent: Googlebot
Disallow: /
User-agent: Googlebot-Mobile
Allow: /
 Robots là gì và cách sử dụng
== > Chặn không cho Googlebot truy cập vào tài nguyên trên website, nhưng lại cho phép Googlebot-Mobile truy cập vào tài nguyên trên website bạn
3.Nên tránh những sai sót sau
khi các bạn sử dụng lại một robots.txt của ai đó hoặc tự mình tạo ra một robots.txt riêng cho website mình thì cũng không tránh khỏi những sai sót
- Phân biệt chữ hoa chữ thường.
- Không được viết dư, thiếu khoảng trắng.
- Không nên chèn thêm bất kỳ ký tự nào khác ngoài các cú pháp lệnh.
- Mỗi một câu lệnh nên viết trên 1 dòng.
Đó là tất cả những gì mà kiến thức của tôi biết về robots.txt , rất mong nhận được sự đóng góp của các bạn.

Bài đăng phổ biến từ blog này

Hack the Pentester Lab: from SQL injection to Shell VM

Today we are going to perform penetration testing in another lab, download it from here . Now install the iso image in VM ware and start it. The task given in this lab is to gain access of administration console and upload PHP webshell. Start your Kali Linux then open the terminal and type netdiscover command for scanning network. Here 192.168.0.105 is my target IP which is shown in the screenshot. Then explore this IP in browser When you will open target IP in browser you will get a web page having heading My Awesome Photoblog . On the top of left side it contains some tags: home; test;  ruxcon; 2010; all pictures; admin. Now Click on test . The above URL : http://192.168.1.105/cat.php?id=1 will run query for ID 1 now let try to find out whether the above URL is vulnerable to sql injection or not by adding ‘ at last of URL: http://192.168.1.105/cat.php?id=1 ’ . And I have got a message of sql error. It confirms that this web page is suffering from sql vulnerability. Now ...

Metasploitable 2 vulnerability assessment

A vulnerability assessment is a crucial part in every penetration test and is the process of identifying and assessing vulnerabilities on a target system. In this part of the tutorial we will be assessing the vulnerabilities available on the network side of the Metasploitable 2 virtual machine. We will be assessing the web applications on the Metasploitable 2 machine in a later tutorial. In the previous Metasploit enumeration and fingerprinting tutorial we’ve learned that the Metasploitable 2 machine contains a lot of vulnerabilities. We have collected valuable information about the target system which we will be using to find known vulnerabilities both on- and offline. Exploitation of these vulnerabilities will be demonstrated in the next exploitation tutorial. In this tutorial we will be looking at a few different ways to perform vulnerability analysis. We will be manually searching for exploits, use scanning tools like Nmap with scripts and we will be...

10 Security Vulnerabilities That Broke the World Wide Web in 2016

Information security is a subject in cyber-world which we can’t think away anymore. Data breaches can cost millions when sensitive information is leaked on the Internet. Zero-day exploits pop up for sale every day in deep web forums in return for Bitcoins. However, few exploits are disclosed in public domain once the vulnerability is patched by the vendor. This past year, we had over 6400 common vulnerabilities and exposures which were issued a CVE ID. There were few major bug fixes by the vendors serving backbone of the Internet. Here is the list of top 10 security vulnerabilities which came to light this year. 1. Dirty Cow (CVE-2016-5195) Discovered by Phil Oester,  Dirty Cow , is a kernel vulnerability that allows any unprivileged existing user to escalate its privilege to root. Root is the highest privilege on any UNIX or LINUX system, which has access to all the files. This vulnerability is known as privilege escalation. COW (Change on Write) is a technique used by Linux to re...