Php removes the black hat SEO search keywords. Php implements blocking of Black Hat SEO search keywords. I will give you a method. my idea is that the big guys who want to do this need to leave QQ or phone numbers for php to block black hats. SEO search keywords
I will give you a method. my thoughts
The idea is that most of the big guys who want to do this need to leave QQ or phone numbers.
Then I will match the rules in the search to find the numbers in the search and then determine the length of the number string to determine whether the search is spam.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
// @ Function blocks search keywords of Black Hat SEO // @ By Yang Xiong Function findNum ($ str = '') {// retrieve all numbers in the string $ Str = trim ($ str ); If (empty ($ str) {return '';} $ Result = ''; For ($ I = 0; $ I If (is_numeric ($ str [$ I]) { $ Result. = $ str [$ I]; } } Return $ result; } $ The_lnum = strlen (findNum ($ q); // Obtain the length of a numeric string If ($ the_lnum> 6) {// you can determine whether the length exceeds 6 to go directly to the search page. Header ("HTTP/1.1 301 Moved Permanently "); Header ("Location: http: //". $ _ SERVER ['http _ host']. "/search. php "); Exit (); } ?> |
Let me give you a way. my train of thought is that most of the big guys who want to do this still need to leave QQ or phone numbers...