Title: Weird string causing 404s
Last modified: January 27, 2018

---

# Weird string causing 404s

 *  Resolved [mdotk](https://wordpress.org/support/users/mdotk/)
 * (@mdotk)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/)
 * Hello, I’ve noticed in my 404 logs that a strange string is being added to some
   URLs and causing a 404:
 * `number>;crid=1833;check_container=true`
 * Is there a way to wildcard any match so that the plugin just strips off that 
   string and 301s to the proper URL. ie example.com/post/number>;crid=1833;check_container
   =true goes to example.com/post/
 * Thanks!

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

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/#post-9908868)
 * Sure, you can use a regular expression to match that particular pattern. If it
   always happens at the end of URL you could use this as the source:
 * `number>;crid=1833;check_container=true$`
 *  Thread Starter [mdotk](https://wordpress.org/support/users/mdotk/)
 * (@mdotk)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/#post-9909467)
 * Sorry what would be the regular expression?
 * Are you saying I need one redirect per URL on my website?
 * I was hoping for something like:
 * 1. In the top box enter “*/number>;crid=1833;check_container=true$”
    2. In the
   bottom box enter “*”
 *  Thread Starter [mdotk](https://wordpress.org/support/users/mdotk/)
 * (@mdotk)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/#post-9909488)
 * Hi again, in fact even when I manually add the URLs to redirect, it still 404s.
 * It seems like there is characters in that string “number>;crid=1833;check_container
   =true$” that stop the redirect working. I discovered another such string too “[
   object Object]”
 *  [CEMBTW](https://wordpress.org/support/users/cembtw/)
 * (@cembtw)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/#post-9914168)
 * In “[object Object]”, the brackets will have to be escaped as “\[object Object\]”
   
   All the characters in your “number” url should be safe, though. Use this tool
   to test various regex matches: [https://regex101.com](https://regex101.com)
 *  Thread Starter [mdotk](https://wordpress.org/support/users/mdotk/)
 * (@mdotk)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/#post-9915007)
 * Thank you, I am still really struggling to get matches.
 * I made a regex (box ticked) rule like /directory/.* redirecting to /directory/
   and then that page /directory/ goes into a redirect loop and won’t display. Chrome
   says “XXX has redirected you too many times”
 * Also, anything I put in like /post-abc/number>;crid=1833;check_container=true
   $ redirecting to /post-abc/ also still returns a 404
 * I exported my settings, deleted and reinstalled the plugin and looked for any
   duplicates and still these problems persist.
    -  This reply was modified 8 years, 4 months ago by [mdotk](https://wordpress.org/support/users/mdotk/).
 *  [CEMBTW](https://wordpress.org/support/users/cembtw/)
 * (@cembtw)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/#post-9919817)
 * [@mdotk](https://wordpress.org/support/users/mdotk/)
 * > * Quantifier — Matches between zero and unlimited times, as many times as possible,
   > giving back as needed (greedy)
 * So `/directory/` will always match your pattern of `\/directory\/.*` (remember
   to escape special characters) and loop.
 * If you want all characters after `/directory/` removed, then you could do something
   like `\/directory\/\S.*` or `\/directory\/\S+`. Try it in regex101, and hover
   over each part to see what they would accomplish.
 * You can also get more information about what is happening during a redirect loop
   with this tool: [http://redirectcheck.com/index.php](http://redirectcheck.com/index.php)
 *  Thread Starter [mdotk](https://wordpress.org/support/users/mdotk/)
 * (@mdotk)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/#post-9919957)
 * [@cembtw](https://wordpress.org/support/users/cembtw/) thanks that is really 
   helpful, I have got it working now
 * I did some exploring on that site and it seems you can substitute out things.
   So I tried
 * `(number%3E;crid=1833;check_container=true34234)+`
 * Which should capture the text I want to delete/remove from the URL string, but
   then I can’t work out how to “redirect it” to whatever URL preceeded that string.
   This would mean that instead of doing individual redirects for every single post,
   I could just have one statement/rule that gets rid of that string.
    -  This reply was modified 8 years, 4 months ago by [mdotk](https://wordpress.org/support/users/mdotk/).
 *  [CEMBTW](https://wordpress.org/support/users/cembtw/)
 * (@cembtw)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/#post-9928665)
 * You could have another capture group to collect the text before our bad string:
   `
   ^(.*)(number>;crid=1833;check_container=true)$`
 * So now we have two capture groups, which the plugin treats as “$1” and “$2”, 
   and can set the target URL as: `$1`.

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

The topic ‘Weird string causing 404s’ 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
 * 3 participants
 * Last reply from: [CEMBTW](https://wordpress.org/support/users/cembtw/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/weird-string-causing-404s/#post-9928665)
 * Status: resolved