One problem that users often face is the server traffic problem, and the site file is the most important part of the chain. The so-called chain stealing refers to the direct linking of other websites to the files on our website. Generally speaking, the objects of the chain are mostly large-volume files with large bandwidth, such as pictures and videos. The main consequences of this are: increased traffic load on the server, affecting the access speed of our website.
If you are using an Apache server, you can easily set it up using .htaccess files to prevent users at other sites from stealing files from our site.
Using .htaccess to ban chaining
Using .htaccess to prevent websites such as images, compressed files, or videos from being stolen by non-Html files is quite simple, by adding them to the file. A few sentences can protect our precious bandwidth. For example, the settings of this site are as follows:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !sudu.cn [NC]
RewriteCond %{HTTP_REFERER} !baidu.com [NC]
RewriteCond %{HTTP_REFERER} !Google.cn [NC]
RewriteCond %{HTTP_REFERER} !bloglines. Com [NC]
RewriteCond %{HTTP_REFERER} !feedburner.com [NC]
RewriteCond %{HTTP_REFERER} !feedsky.com [NC]
RewriteRule .*\\ .(gif|
Jpg)$http://sudu.cn/no.png [R,NC,L]
Explain the above statement briefly:
1. RewriteCond %{HTTP_REFERER} !^$ [NC]
Allows access to "HTTP_REFERER", which allows the user to enter the image file directly when entering the image address in the browser address bar. In general, this is optional, but it is recommended that if you force it to have "HTTP_REFERER" to access it, it may cause problems, such as when a user accesses through a proxy server.
2, RewriteCond %{HTTP_REFERER} !45it.net [NC]
Set the HTTP source to allow access, including our site itself, Google, Baidu, Bloglines, Feedburner, etc.
3, RewriteRule .*\\.(gif|
Jpg|
Png)$ http://45it.net/no.png [R,NC,L]
Define the image to be replaced when the chain is stolen, and let all the pages that hack the jpg, gif, png, etc. Display the no.png file in the root directory. Note: Do not replace the displayed image in the directory where the anti-theft chain is set, and the smaller the image file size, the better. Of course, you can also use the following statement instead of setting a replacement image:
RewriteRule .*\\.(gif|
Jpg|
Png)$ – [F]
4. Explain that R, NC, and L
R is the meaning of steering
NC refers to case insensitivity
The role of L is to indicate the end of this turn, the subsequent turn is not affected by the previous judgment statement
5, to prevent the file type of the chain
In the middle is gif, jpg, png, and other file types can be changed or added as needed, such as rar, mov, etc., use between different file extensions “|
& rdquo; segmentation.
In this case, you can basically prevent theft of the stolen chain, and you can minimize the fearless consumption of server traffic.
Anyone who knows about the network knows that dual network cards can
code online, we provide it directly to everyone, do not need to find it, the code is as follows: reg
As Web servers are being targeted by more and more hackers and worm m
Summarize the security settings of the VPSgtedit, select file to export, take a f
3 major errors to avoid when backing up virtual servers
Teach you to choose server memory from technical details
IIS 301 redirects to the domain name at the beginning of www
Installation and pay attention to matters of a
Server common soft fault resolution ideas
Performance is soaring! Teach you how to group RAID0 disk arrays
IDC server administrator must have LINUX knowledge
Memcache and memcached installation process
How to restore xml in IIS configuration
Prevent the replacement of shift after the door lift (sethc.exe back door)
Windows7 system activation tool Daquan
Win7 can't boot after removing iertutil.dll. Solution
Win8 set up automatic networking method
Win10 App Store opens correct posture fix can't open problem
How does the Win8 system fix the program on the start menu?
Microsoft promises to significantly increase the speed of installation in Windows 8.
How to upload an app in the Windows Store
What should I do if Win7 is cancelled due to the limitations of this computer?