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 Gibson VM (CTF Challenge)

It’s a boot2root challenge and it does not get over with getting root access. You have to find flag also. So let’s start. First of all download lab from https://download.vulnhub.com/gibson/gibson.ova Now open kali terminal and like always start with first step i.e. netdiscover netdiscover it shows all the hosts those are up in our network and from here we get our target ip. Target IP: 192.168.1.6 As our target is all set we are going to scan it with nmap which will show all the open ports. In this case open ports are only two i.e. 22 and 80. nmap –p- -A 192.168.1.6 As from the above result we have got 80 port open so we will open target ip in browser. It shows an accessible directory. Let’s try opening it as we cannot see anything important here. Oh no such luck with this also. It’s written the result will be found by brute force but there is no place where we can apply brute force. As we do not have any other option so let’s just go to view page source to see if we could get a...

Penetration Testing in PwnLab (CTF Challenge)

In this article we will walkthrough a root2boot penetration testing challenge i.e PwnLab. PwbLab is a vulnerbale framework, based on the concept of CTF (capture the flag), with a bit of security which is a little complicated to bypass. But it’s not impossible. So, let us learn how we can get its access. Download From Here Now to start let us, firstly, consider that we do not know the IP of the PwnLab, therefore search for the IP address before hand and for that there is a command that shows us all the IP’s present in our network, so go to the terminal of you Kali and type : netdiscover Target IP = 192.168.0.105 And to know that we start our penetration testing. So, first, we will now scan with nmap , we will apply an aggressive scan as it gives detailed information and is fast. The command is : nmap -A 192.168.0.105 We have the result of scanning and as you can see there are only three ports open and they are: 80, 111, 3306. Our target IP is 192.168.0.105 as its MAC Vendor is...

Hacking the Heartbleed Vulnerability

Welcome back, my greenhorn hackers! In recent weeks, the Heartbleed vulnerability of OpenSSL has been dominating the information security headlines. This vulnerability enables an attacker to extract data from the server's memory that may contain authentication credentials, cookies, the servers private key, and personally identifiable info (PII) that could be used for identity theft. As a result, websites around the world have been scrambling to close this hole. Fortunately for us, many still have not, and many may never be closed. Basically, OpenSSL is an encryption library used in HTTPS (secure HTTP). The idea is that any data traveling over this secured version of HTTP should be secure and encrypted. During communication, OpenSSL uses a "heartbeat" that echoes back data to verify that the data was received correctly. It's kind of like one machine telling the other, "Yes, I got that data and you can send more now." The Heartbleed vulnerabi...