WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
Redirection wildcard to redirect folder contents to folder (2 posts)

  1. elwalker
    Member
    Posted 1 year ago #

    I need to create a regular expression to redirect all pages contained within a folder (directory) to a new folder (directory) but where the page names are all different.

    e.g. the following pages:
    ​/activity-directory​/water​/marine-activity-safaris​/
    ​/activity-directory​/water​/marine-activity-safaris​/era-adventures​/
    ​/activity-directory​/water​/marine-activity-safaris​/era-adventures​/review​/
    /activity-directory/water/marine-wildlife-safaris-cornwall/cornish-sea-safari's/
    /activity-directory/water/marine-wildlife-safaris-cornwall/cornish-sea-safari's/details/

    All of these pages and pages like them (everything) in the OLD ​/activity-directory​/water​/marine-activity-safaris​/ need to go to JUST ONE NEW page:

    /activities/boat-trips-sea-safaris-cornwall/

    I've tried:
    source: ​/activity-directory​/water​/marine-activity-safaris​/*
    target: /activities/boat-trips-sea-safaris-cornwall/

    ... and ticked regex box

    But this only works if names of pages in the folder are exactly the same. All mine have changed.

    Can anyone suggest the correct code to redirect everything in an old folder to just one new page?

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

  2. luigitec
    Member
    Posted 1 year ago #

    Try this:

    Source:
    ​/activity-directory​/water​/marine-activity-safaris​/(.*?)

    Target:
    http://your-domain.com/activities/boat-trips-sea-safaris-cornwall/

    And check the regex option.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.