<p>FWIW, I would actually recommend doing this rewrite at the web server level, because then these accesses will have a much lower impact on your site.</p>
<p>If you add the redirect to Nginx (or whatever your webserver is), these bot-spam hits won't have to cause Nginx, Craft, etc. to kick in before they operate. An example is here for Nginx:</p>
<p><a href="https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L72" rel="nofollow noreferrer">https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L72</a></p>
<pre><code>    # For WordPress bots/users
    location ~ ^/(wp-login|wp-admin|wp-config|wp-content|wp-includes|xmlrpc) {
        return 301 https://wordpress.com/wp-login.php;
    }
</code></pre>

CC BY-SA 4.0
2022-03-17T01:13:03.180Z
2022-03-17T01:13:03.180Z
andrew.welch
<p>Got it. Figured I would keep this here for anyone else looking to do this (or similar).</p>
<pre><code>.*/wp-content($|/.*) 
</code></pre>

CC BY-SA 4.0
2022-03-16T14:44:32.677Z
2022-03-16T14:44:32.677Z
gjhead
<p>Recently rebuilt a site that was on wordpress to Craft CMS, and I am seeing a ton of hits trying to find files in /wp-content - Is there a way I can just set Retour to catch any request for anything in the /wp-content directory are redirect it to a single image file?</p>

<redirect><redirection><plugin-retour>
Retour Plugin: Redirect Entire Directory to file
# Retour Plugin: Redirect Entire Directory to file

(Asked by: username_0 on 2022-03-16)

Recently rebuilt a site that was on wordpress to Craft CMS, and I am seeing a ton of hits trying to find files in /wp-content - Is there a way I can just set Retour to catch any request for anything in the /wp-content directory are redirect it to a single image file?

**Tags:** redirect, redirection, plugin-retour


---

## 2 answers

### Answer by username_1 on 2022-03-17. Score: 3

FWIW, I would actually recommend doing this rewrite at the web server level, because then these accesses will have a much lower impact on your site.
If you add the redirect to Nginx (or whatever your webserver is), these bot-spam hits won't have to cause Nginx, Craft, etc. to kick in before they operate. An example is here for Nginx:
https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L72
    # For WordPress bots/users
    location ~ ^/(wp-login|wp-admin|wp-config|wp-content|wp-includes|xmlrpc) {
        return 301 https://wordpress.com/wp-login.php;
    }


---

### Answer by username_0 on 2022-03-16. Score: 1

Got it. Figured I would keep this here for anyone else looking to do this (or similar).
.*/wp-content($|/.*)


---

