• Resolved Fanaticweb

    (@fanaticweb)


    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/) 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/) 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
    https://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

    (@johnny5)

    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 to test the expression.

    Thread Starter Fanaticweb

    (@fanaticweb)

    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.