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...

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...