Title: Regex
Last modified: June 23, 2022

---

# Regex

 *  Resolved [Rik0399](https://wordpress.org/support/users/rik0399/)
 * (@rik0399)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/regex-11/)
 * Hi John,
 * My site is being bombed hundreds of times every hour by something/someone that
   is adding to a post url?
 * Should be :
 * /essential-travel-insurance/
 * But getting this submitted :
 * /essential-travel-insurance/baseurl:[https:////siteuk.com//wp-contenthttps://www.google.com](https://wordpress.org/support/topic/regex-11/?output_format=md)
 * So I tried this :
 * /essential-travel-insurance/.* with Regex
 * /essential-travel-insurance.* with Regex
 * /essential-travel-insurance(.*) with Regex
 * /essential-travel-insurance/(.*) with Regex
 * I tried them all but in both normal and the incognito browsers – “too many loops”
   message
 * So I tried the above without using Regx :
 * In normal works but in incognito – “too many loops” message
 * Also, same problem where something being added before the url like this :
 * /listing/essential-travel-insurance/
 * Should be :
 * /essential-travel-insurance/
 * So tried this :
 * ^/essential-travel-insurance/ with and with regex – nothing worked?
 * Any ideas would be welcomed as I’m going insane
 * Many Thanks 😉

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/regex-11/#post-15765369)
 * A redirect isn’t going to stop the requests, so I would advise considering the
   utility of doing it.
 * As with an regex you need to not match the target, and you can use [https://regex101.com](https://regex101.com)
   to test a regular expression. [https://wordpress.org/support/topic/loop-20/](https://wordpress.org/support/topic/loop-20/)
   may be a good technique to use.
 *  Thread Starter [Rik0399](https://wordpress.org/support/users/rik0399/)
 * (@rik0399)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/regex-11/#post-15767903)
 * Hi John,
 * “I would advise considering the utility of doing it.”
 * What does that mean exactly?
 * Use another plugin because I can’t use yours to redirect bad urls?
    -  This reply was modified 3 years, 12 months ago by [Rik0399](https://wordpress.org/support/users/rik0399/).
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/regex-11/#post-15768048)
 * No, it doesn’t mean that. It means consider if it is useful to redirect those
   URLs
 *  Thread Starter [Rik0399](https://wordpress.org/support/users/rik0399/)
 * (@rik0399)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/regex-11/#post-15768125)
 * Hi,
 * Well, it is useful since they are causing thousands 404’s like this :
 * /essential-travel-insurance/baseurl:[https:////siteuk.com//wp-contenthttps://www.google.com](https://wordpress.org/support/topic/regex-11/?output_format=md)
 * So given the explanation provided, and perhaps employing a carat as now URL’s
   are being appended with, as an example :
 * /listing/essential-travel-insurance/ which should be : /essential-travel-insurance/
 * Would the following be the correct format with regex?
 * ^/essential-travel-insurance(.*) so it goes to /essential-travel-insurance/
 * So not only will it fix the appendings at both the beginning and the end, but
   will also not cause a redirection loop error?
 * So what would be the suggested format to prevent this, please?
 * Many Thanks?
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/regex-11/#post-15768179)
 * As I’ve said before, 404s are not bad.
 * You asked a similar question a few days ago here, and the same solution will 
   still work:
 * [https://wordpress.org/support/topic/loop-20/](https://wordpress.org/support/topic/loop-20/)
 *  Thread Starter [Rik0399](https://wordpress.org/support/users/rik0399/)
 * (@rik0399)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/regex-11/#post-15768220)
 * At the risk of incurring someone’s wrath on what is essentially for you, a simple
   question …
 * Do you not think it would be more helpful toward promoting this plugin if you
   were to offer a “practical response/solution/example” rather than detracting 
   from the question in such an obtuse manner?
 * How hard is that for you exactly?
 * Sure, the plugin is “free” for which I and many others are no doubt, most grateful–
   as I for one would be looking toward buying this plugin at a premium level but,
   it’s the level of “support” such as this that I would also value.
 * Or would you rather I use another not too dissimilar plugin and have done with
   it?
 * Take your pick, John …
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/regex-11/#post-15768327)
 * The answer is in your previous question from a few days ago:
 * [https://wordpress.org/support/topic/loop-20/](https://wordpress.org/support/topic/loop-20/)
 * To copy/paste from that solution, use `.+` instead of `.*`.
 * I am not sure what you mean about detracting from the question, or incurring 
   wrath. I have provided the solution several times. I also pointed out that 404s
   are not bad, and do not always need to be redirected. This, to me, seems like
   useful advice. I’m sorry if you think this is unhelpful or obtuse. I am not picking
   anything – I am just answering your questions.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Regex’ is closed to new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [John Godley](https://wordpress.org/support/users/johnny5/)
 * Last activity: [3 years, 12 months ago](https://wordpress.org/support/topic/regex-11/#post-15768327)
 * Status: resolved