增加主題的安全性
來(lái)源于:
https://blog.wpjam.com/m/block-bad-queries/
下面代碼檢查下訪問(wèn)的 URL 是否長(zhǎng)度 < 255,是否有那與 “eval(” 或者 “base64”字符串,這些都是惡意 URL 請(qǐng)求的特征,不過(guò)貌似會(huì)和 Google Custom Search 有沖突。
<?php
/* Plugin Name: Block Bad Queries */
if (strlen($_SERVER['REQUEST_URI']) > 255 ||
strpos($_SERVER['REQUEST_URI'], "eval(") ||
strpos($_SERVER['REQUEST_URI'], "base64")) {
@header("HTTP/1.1 414 Request-URI Too Long");
@header("Status: 414 Request-URI Too Long");
@header("Connection: Close");
@exit;
} ?>
復(fù)制到主題的?functions.php
?即可。