Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess rewrite rule remove everything after RK=0/RS=

I have a website that is getting a lot of requests for pages that don't exist.

All the requests are based on an existing page, but have RK=0/RS= plus a random string of characters at the end.

For example, the request is:

www.domain.com/folder/article/RK=0/RS=M9j32OWsFAC_u8I6a0xOMjYKU_Q-

but the page www.domain.com/folder/article does exist.

I would like to use htaccess to say:

if RK=0/RS= exists, remove it and everything after

but haven't been able to get it working.

All the htaccess rules talking about removing query strings, but I'm guessing because this doesn't have a ? it's not a query.

Could someone help me understand how to do this?

like image 644
user82320 Avatar asked Mar 31 '14 12:03

user82320


2 Answers

Someone found where this mess is coming from. http://xenforo.com/community/threads/server-logs-with-rk-0-rs-2-i-now-know-what-these-are.73853/

It looks like actually NOT malicious, it's something broken with Yahoo rewrites that create URLs that point to pages that don't exist. The demo described on xenforo does replicate it, and the pattern of the URLS that Yahoo is producing:

http://r.search.yahoo.com/_ylt=A0SO810GVXBTMyYAHoxLBQx./RV=2/RE=1399899526/RO=10/RU=http%3a%2f%2fkidshealth.org%2fkid%2fhtbw%2f/RK=0/RS=y2aW.Onf1Hs6RISRJ9Hye6gXvow-

Sure does look like the RV=, RE=, RU=, RK=, RS= values are of the same family. It's just that somewhere the arg concatenation is screwing up on their side.

like image 165
dman Avatar answered Nov 15 '22 05:11

dman


You can use this rule in root .htaccess file:

RewriteEngine On

RewriteRule ^(folder/article/)RK=0/RS= /$1 [L,NC,R=301]
like image 3
anubhava Avatar answered Nov 15 '22 07:11

anubhava