Author: Malte Bublitz
Language/File type: Apache Config (.htaccess, apache.conf)
Description
Use Apache's mod_rewrite to redirect bots (crawlers) searching for WordPress instances to a music video.
Since many of my domains are targeted by bots searching for WordPress instances[^1], I had the idea to rickroll them by redirecting them to the music video of Rick Astleys song “Never Gonna Give You Up” <http://www.youtube.com/watch?v=eBGIQ7ZuuiU>.
NOTE: The default HTTP status code for the RewriteRule “[R]” flag is *302 Found*. To use a different status code like *301 Moved Permanently*, you have to change it to “[R=301]” for all RewriteRule statements.
[^1]: This results in over 95% failed requests, especially on subdomains and over night …
Code
1
2
3
4
5
6
7
8
9
10
11
# Rickroll-Redirect for WordPress crawlers
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/wp-login\.php$ "http://www.youtube.com/watch?v=eBGIQ7ZuuiU" [R]
RewriteRule ^/wp-update\.php$ "http://www.youtube.com/watch?v=eBGIQ7ZuuiU" [R]
RewriteRule ^/wp-admin(.*)$ "http://www.youtube.com/watch?v=eBGIQ7ZuuiU" [R]
RewriteRule ^/wp-includes(.*)$ "http://www.youtube.com/watch?v=eBGIQ7ZuuiU" [R]
RewriteRule ^/wp-content(.*)$ "http://www.youtube.com/watch?v=eBGIQ7ZuuiU" [R]
RewriteRule ^/wp-includes(.*)$ "http://www.youtube.com/watch?v=eBGIQ7ZuuiU" [R]
</IfModule>