Support » Plugin: Redirection » Regex for simple redirection

  • I am trying to set up a redirection but cannot get the regex right.

    I have hundreds of 404’s for URL’s like


    All I want to do is to redirect them to


    with creating an infinite loop.

    I have tried redirecting with /folder/(.*) to /folder/ and several other variations but cannot get this to work without creating a loop.

    Does anyone have a simple regex to do this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Use /folder/(.+) instead and you should be fine 😉

    .* means 0 or more characters
    .+ means 1 or more characters, so that should avoid the infinite loop

    Actually you don’t even need the brackets and you may want to anchor to the beginning of the url, so use the below instead:


    Should match:

    Will prevent matching on:

    The last comment almost worked for me, I currently intercept:


    What I am finding is that this does match:


    … but not /mantis/page.php

    For some reason, the .php extension throws this error:

    “Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.
    Apache/2.2.26 (******) Server at ************ Port 443″

    Any suggestions on how to prevent the .php extension causing this crash would be appreciated. Thanks.

    Strange, it should not do that. Can you try to see if this works better ?


    Unfortunately, the result is the same: 500 Internal Server Error

    What I’ve found is that if “.php” is simply present, then the 500 error will occur.

    I also tried your suggestion without the $ symbol and it didn’t help either.

    This is the URL I’m trying:

    Hang on… you are using the * again… causing you to get into the infinite redirect loop….

    I’m sorry, but I didn’t understand the last comment.

    The regex I’m using is:

    There is only one * in there. So the 500 error is an infinite redirect loop?

    Any other suggestions? (Your help is really appreciated)

    I believe it might be.

    You’re probably better off adding a rule for this to your .htaccess file instead of using the redirect plugin.

    Are you familiar with editing .htaccess ?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Regex for simple redirection’ is closed to new replies.