WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
Plugin Redirection - wildcard expression (7 posts)

  1. Mr E
    Member
    Posted 1 year ago #

    My goal is to use the plugin Redirection to forward a whole section of the website automatically, I would like it to be so that I can wildcard a url so that any child items are redirected:

    http://www.domain.com/folder/ is set to go to http://www.domain.com

    and all other child items such as domain.com/folder/1/ and domain.com/folder/2 automatically follow the rule with no further specification.

    http://wordpress.org/extend/plugins/redirection/

  2. Joseph
    Member
    Posted 1 year ago #

    I'm looking for the same solution.

  3. Todd
    Member
    Posted 1 year ago #

    Me as well.

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

  4. berchman
    Member
    Posted 1 year ago #

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

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

    No luck.

    Any suggestions are welcome.
    Thanks,
    Bert

  5. sroot
    Member
    Posted 1 year ago #

    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

  6. berchman
    Member
    Posted 1 year ago #

    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

  7. jani74
    Member
    Posted 1 year ago #

    "Maybe the / is an exception in this plugin."

    yep, it doesn't like it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic