Easy to use website anti image code

await 2021-09-15 10:01:02

Mirror website principle analysis

Mirror image in physics refers to the imaging of an object on a mirror , Extended to the Internet as like as two peas . There are several common ways of mirroring : The first is to analyze in real time through the program , A simple example , hypothesis aaa.com This website is bbb.com The image address of , When users access aaa.com when , The program of the site will come bbb.com Grab the page information and return it to the visitor , In essence, it is still reading the data of the source station . The second is to use the imitation station software to grab all pages, save them as static pages and deploy them to the server . The third is malicious parsing , For example, reverse proxy your website . The above two generalize the general mirroring methods , The specific implementation shall be adjusted as needed , For example, timing cache, etc .

The harm of mirror websites

Others mirror your website , Explain that your website content is original and valuable , Of course, it doesn't rule out maliciously engaging you or having nothing to do when you're full . Mirror websites may replace some content and add malicious Links , So as to achieve illegal purposes , And this image is equivalent to intercepting our traffic in the search engine , It belongs to malicious mirroring . For a new website , Search engines can't tell which is the origin , Then the mirror station will be included , The source station is deleted and included . Used in search engines intitle Search instructions search for the full title of your website , For example, our website is :intitle PM Flower language Pavilion | Qingcheng Huayu river has no moon Then see if there are any websites that are not different from your content except the domain name , If there is , That basically confirms that your website has been mirrored .

intitle yes SEO Advanced search instructions in ,intitle The keyword command returns the page title Pages with keywords in .Goolge And Baidu support intitle Instructions .

Solutions to malicious mirroring

if (document.location.host != "bt.myltd.ltd" && document.location.host != "bt.myltd.ltd" ) {
alert(' Warning ! It is detected that the website is a malicious mirror site , Will jump to the official site for you immediately !');
location.href = location.href.replace(document.location.host,'bt.myltd.ltd');
}

Change the domain name in the above code to the home address of your website .

// Prevent malice HTTP_USER_AGENT collection
$ua = $_SERVER['HTTP_USER_AGENT'];
$now_ua = array('FeedDemon ','BOT/0.1 (BOT for JCE)','CrawlDaddy ','Java','Feedly','UniversalFeedParser','ApacheBench','Swiftbot','ZmEu','Indy Library','oBot','jaunty','YandexBot','AhrefsBot','MJ12bot','WinHttp','EasouSpider','HttpClient','Microsoft URL Control','YYSpider','jaunty','Python-urllib','lightDeckReports Bot','PHP');
if(!$ua) {
header("Content-type: text/html; charset=utf-8");
die(' Please do not collect this site , The gatherer wood has a small JJ! Please visit... Normally !');
}else{
foreach($now_ua as $value )
if(eregi($value,$ua)) {
header("Content-type: text/html; charset=utf-8");
die(' Please do not collect this site , The gatherer wood has a small JJ! Please visit... Normally !');
}
}

Just put it at the beginning of the entry file , But using this method may kill by mistake RSS subscribe , Adjust to your own needs UA head .

This article altogether 636 Number of words , Average reading time ≈ 2 minute

Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .

Please bring the original link to reprint ,thank
Similar articles

2021-09-15

2021-09-15

2021-09-15

2021-09-15

2021-09-15