WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
[resolved] Regex to Consolidating 301 Redirects (3 posts)

  1. TheHigherEdCIO
    Member
    Posted 2 years ago #

    I have about 35 301 redirects from an permalink change a whielago I would like to consolidate into a single redirect using Regex.

    Source URL format: /2011/02/my-post.html
    Target URL fromat: /2011/02/23/my-post/

    I need a Regex to match the source to the target where there is now a date and the .html has been replaced with '/'

    The source part seems clear: '/(\d*)/(\d*)/(.*)' or '/(\d*)/(\d*)/(.*).html'
    But I am struggling on the target which needs to look for a new data element and match on the year, month and postname

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

  2. pronoiac
    Member
    Posted 2 years ago #

    The day's missing from the source, so regex can't generate it.

  3. TheHigherEdCIO
    Member
    Posted 2 years ago #

    That seemed to be the conclusion but I am not smart enough to know for sure.

    Thx

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags