WordPress.org

Support

Support » Plugins and Hacks » Plugin Redirection – wildcard expression

Plugin Redirection – wildcard expression

Viewing 6 replies - 1 through 6 (of 6 total)
  • Joseph
    Participant

    @jbojang

    I’m looking for the same solution.

    Todd
    Participant

    @toddedelman

    Me as well.

    Tried using the format /folder/(.*) but it did not work.

    berchman
    Participant

    @berchman

    I tried like Todd to get a wildcard to work and had no luck.

    /slug/(.*) => /newslug/(.*)

    No luck.

    Any suggestions are welcome.
    Thanks,
    Bert

    Strange, I read that .* matches any character any number of times. Maybe the / is an exception in this plugin.

    Anyway, I’d avoid the problem and create a set of redirects, eg:

    source:/folder/
    target:/

    source/folder/(.*)/
    target:/

    source:/folder/(.*)/(.*)/
    target:/

    @berchman
    try
    Source: /slug/(.*)
    Target: /newslug/$1
    and don’t forget to tick the regex checkbox.

    For each ‘match’, the regex makes the match available as a variable, $1.
    So in the first example
    source:/folder/(.*)/(.*)/
    target:/newfolder/$1/$2/

    I had to do a similar thing for my redirects, my notes here

    I hope that helps,
    Steve

    berchman
    Participant

    @berchman

    Steve,
    Thanks for sharing the link to your site with examples.
    Really helps.

    This is what I have now and seems to work.

    source url:
    /questions/([0-9a-zA-Z_-]*)/(.*)

    target url:
    /question-posed/$2

    This seems to get things working and out of the redirect loop.

    Best regards,
    Bert

    “Maybe the / is an exception in this plugin.”

    yep, it doesn’t like it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Plugin Redirection – wildcard expression’ is closed to new replies.