Title: RegEx redirection issue
Last modified: October 25, 2020

---

# RegEx redirection issue

 *  Resolved [Fanaticweb](https://wordpress.org/support/users/fanaticweb/)
 * (@fanaticweb)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/regex-redirection-issue/)
 * Hello John,
 * I’ve been using RegEx for a while and lately it’s not working as it used to, 
   not sure if it’s because of the latest update or just me not applying it properly.
 * **Scenario:**
    I had deleted a root folder named “Advertise” ([https://www.domain.com/advertise/](https://www.domain.com/advertise/))
   which contained a PhP advertising module and inevitably generated 404’s such 
   as : /advertise/purchase.php?do=banner&zone=1 /advertise/zones.js /advertise/
   js_http.php?cls=esdghsegse /advertise/js.php?type=banner&align=center&zone=3 /
   advertise/purchase.php?do=banner&zone=1 etc.
 * Lately I created a page in WP and also named it Advertise ([https://www.domain.com/advertise/](https://www.domain.com/advertise/))
   and included a form on that page.
 * Here is the typical RegEx string I recently applied as a catch-all redirect, 
   I tried to redirect all those links back to /advertise/:
 * Source URL –> ^/advertise/(.*)
    Target URL –> /advertise/
 * It does redirect to /advertise/ but I keep getting the error:
 * This page isn’t working right now
    [http://www.domain.com](http://www.domain.com)
   redirected you too many times. ERR_TOO_MANY_REDIRECTS
 * I looked up the logs to see if there were other redirects, and to my surprise,
   there have been as I had tackled few of them manually back then by applying simple
   redirects back to /advertise/ so I went ahead and deleted those manual redirects
   along with the newly created RegEx redirect, cleared the cache, recreated the
   regex redirct mentionned above, tried a different browser, to no avail, what 
   am I doing wrong or what am I missing here?

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

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/regex-redirection-issue/#post-13577755)
 * Your expression is redirecting itself. You need to change it not to redirect 
   the target. This can be done by changing the `*` to a `+`.
 * When in doubt use [https://regex101.com](https://regex101.com) to test the expression.
 *  Thread Starter [Fanaticweb](https://wordpress.org/support/users/fanaticweb/)
 * (@fanaticweb)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/regex-redirection-issue/#post-13577760)
 * Got it, just tested it too, for a bried split second I got the error but then
   redirected it to /advertise/, cleared the cache and tried again, it redirected
   right away, thank you for the quick reply and the headsup on that test link.

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

The topic ‘RegEx redirection issue’ 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/)

## Tags

 * [ERR_TOO_MANY_REDIRECTS](https://wordpress.org/support/topic-tag/err_too_many_redirects/)
 * [regex](https://wordpress.org/support/topic-tag/regex/)

 * 2 replies
 * 2 participants
 * Last reply from: [Fanaticweb](https://wordpress.org/support/users/fanaticweb/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/regex-redirection-issue/#post-13577760)
 * Status: resolved