RewriteRule for .html / RK = 0 / RS = [random_string]

I have a Joomla 2.5 based site where I am trying to redirect URLs containing /RK=0/RS= with random code at the end. They cause 404 errors in the server access log. Here are some examples:

 /blog/name-of-blog-post.html/RK=0/RS=_ep9ZOcaWbdT5g4pr_m9ddy3Rxo- 

I found several solutions that do not work for me:

 RewriteEngine On RewriteRule ^(.*)/RK=0/RS= /$1 [L,NC,R=301] RewriteRule ^/blog/(.*)/RK=0/RS= /$1 [L,NC,R=301] RewriteRule ^/blog/(.*)(.html)/RK=0/RS= /$1 [L,NC,R=301] RewriteRule ^/blog/(.*)(.html)/RK=0/RS=(.*) /$1 [L,NC,R=301] RewriteRule ^(.*)RK=0/RS= /$1 [L,NC,R=301] RewriteRule ^(.*)RS=^ /$1 [L,NC,R=301] RewriteRule ^(.*)RK= /$1 [L,NC,R=301] RewriteRule ^(.*)/RK= /$1 [L,NC,R=301] 

Any ideas on how to encode the rewrite to catch and delete /RK=0/RS=_ep9ZOcaWbdT5g4pr_m9ddy3Rxo- in the above example? I have hundreds of them with different random codes at the end of the urls.

+1
apache .htaccess mod-rewrite rewrite
source share
1 answer

For the Joomla site, make sure this is your very first rule in the .htaccess root directory:

 RewriteEngine On RewriteRule ^(.+?)/RK=0/RS= /$1 [L,NC,R=301,NE] 
0
source share

All Articles