Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-17T01:13:03.180Z
Answers.LastActivityDate: 2022-03-17T01:13:03.180Z
Answers.UserDisplayName: andrew.welch
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-16T14:44:32.677Z
Answers.LastActivityDate: 2022-03-16T14:44:32.677Z
Answers.UserDisplayName: gjhead
Body: <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>
  
Tags: <redirect><redirection><plugin-retour>
Title: Retour Plugin: Redirect Entire Directory to file
ThreadText: # 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($|/.*) 
  
  ```
  
  
  ---
  
  