Title: String
Last modified: October 26, 2021

---

# String

 *  Resolved [Rik0399](https://wordpress.org/support/users/rik0399/)
 * (@rik0399)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/)
 * Hi John,
 * I get this problem by the ton and am not sure if it’s someone maliciously doing
   this or a bot.
 * I have a listing called – /pretty-flowers/
 * Getting various themes on the above link such as :
 * /prestige-flowers-is-voted-1-for-next-day-flower-delivery-and-review-florist-
   uk-editors-choice/
 * So to catch these I used :
 * /pretty-flowers/(.*) or /pretty-flowers(.*) – both with and without REGEX
 * If I DON’T apply REGEX I see a 404, if I DO apply REGEX I see “Too many redirects”
   messege?
 * Would appreciate a point, please.
 * Obliged 😉

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

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/#post-15010403)
 * Your example doesn’t match `/pretty-flowers/` so I don’t know how they are connected.
 * You cannot have regular expression characters without the regex option being 
   enabled – you will always have a 404.
 * If you create a loop then you need to stop the loop, by making sure your expression
   does not match the target.
 *  Thread Starter [Rik0399](https://wordpress.org/support/users/rik0399/)
 * (@rik0399)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/#post-15011377)
 * Thanks for that,
 * I was hoping, understanding the problem, that you were able to offer a solution
   to what I was refering too?
 * The full url would be :
 * [http://www.mysite.com/pretty-flowers/](http://www.mysite.com/pretty-flowers/)
 * So someone/bot is using :
 * [http://www.mysite.com/pretty-flowers-is-voted-1-for-next-day-flower-delivery-and-review-florist-uk-editors-choice/](http://www.mysite.com/pretty-flowers-is-voted-1-for-next-day-flower-delivery-and-review-florist-uk-editors-choice/)
 * So I want this to redirect to :
 * [http://www.mysite.com/pretty-flowers/](http://www.mysite.com/pretty-flowers/)
 * So how do I do that, please?
 * Many Thanks
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/#post-15011922)
 * As in previous requests, it’s not necessary to fix all 404s. If someone is requesting
   a URL that doesn’t exist and isn’t linked, then it isn’t necessary to fix it –
   you will endlessly chase these, and it is a waste of time. A 404 is the correct
   response.
 * If the URL is being legitimately requested because of an old link then it is 
   easiest just to create a plain redirect for the exact URL.
 *  Thread Starter [Rik0399](https://wordpress.org/support/users/rik0399/)
 * (@rik0399)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/#post-15011993)
 * Hi John,
 * I want to be able to redirect any/all URLs to relevant pages on my site not generate
   endless 404’s as these can be detrimental, SEO speaking.
 * So, and as an example, if a URL is either not on my site or a malicious bot calling
   a spurious url and rather allow it to fall to a 404, I would much prefer to redirect
   such to a relevant area on my site such as my blog.
 * So how do I make that happen, to cite my earlier examlpe, using your plugin, 
   please?
 * Regards,
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/#post-15012021)
 * Legitimate 404s are detrimental. Spurious 404s are not. I do not advise redirecting
   these – it is a fruitless task with no benefit.
 * If you still want to redirect that URL then your regex needs to match the spurious
   URL. Your examples above only match the valid URL, which is not what you want.
 * These:
    `/pretty-flowers/(.*)` `/pretty-flowers(.*)`
 * Match `/pretty-flowers/`. They do not match `/pretty-flowers-is-voted-1-for-next-
   day-flower-delivery-and-review-florist-uk-editors-choice/`. You need to match`/
   pretty-flowers-is-voted-1-for-next-day-flower-delivery-and-review-florist-uk-
   editors-choice/` and not `/pretty-flowers/`
 *  Thread Starter [Rik0399](https://wordpress.org/support/users/rik0399/)
 * (@rik0399)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/#post-15012642)
 * Hi John,
 * Thanks for that, appreciated.
 * Here’s my problem …
 * This URL is correct :
 * /uksoccer-shop/
 * The following url, of which /uksoccer-shop/ is correct but creates a 404?
 * /uksoccer-shop/?feed_id=1750&_unique_id=5f6cf071902b1
 * It only works if I do this :
 * /uksoccer-shop/(.*) and checking REGEN?
 * Hope that makes sense and again, my thanks for your time 🙂
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/#post-15012929)
 * It’s a little strange that the query parameters cause a 404. Is that a plugin?
   Standard WordPress pages don’t react in that way.
 * `/uksoccer-shop/(.*)` will match the target `/uksoccer-shop/`, which will cause
   a loop. Using `(.+)` means it requires at least one character.
 *  Thread Starter [Rik0399](https://wordpress.org/support/users/rik0399/)
 * (@rik0399)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/#post-15015258)
 * Hi John,
 * Thanks for that, it’s driving me mad for sure.
 * I would be happy to share the download csv file with you
 * With so many expressions being thrown at the site, trying to pass on ID queries
   for record stats, and n top of that, tons of hackers trying to call WP files …
 * A lot of work

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

The topic ‘String’ 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/)

 * 8 replies
 * 2 participants
 * Last reply from: [Rik0399](https://wordpress.org/support/users/rik0399/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/string-2/#post-15015258)
 * Status: resolved