Forums

301 Redirect and change path (5 posts)

  1. Ghalt
    Member
    Posted 9 months ago #

    I have a site that has the following permalink structure.

    subdomain.domainname.com/yyyy/mm/blog-post-name

    I want to move the domain to a new domain, AND remove the year and month sub-path. So, I'd like the above post to redirect to:

    newdomainname.com/blog-post-name

    There are no duplicate blog post names, so it shouldn't be a problem.

    I've got a lot of inbound links that I don't want to break.

    Does anyone know how I write the 301 code to move the blog correctly?

    Thanks!

  2. Samuel B
    moderator
    Posted 9 months ago #

  3. Ghalt
    Member
    Posted 9 months ago #

    OK...I see that plugin, and I see that it might actually work.

    But...I'm still not sure (even after reading the documentation page) how to code it to pull the path for any year, any month...

    I suppose I could make multiple entries, 12 for each year I've had the blog. But I bet there's a better way.

  4. Samuel B
    moderator
    Posted 9 months ago #

  5. Ghalt
    Member
    Posted 9 months ago #

    I guess what I'm asking for is the specific regex code. I'm a regex noob.

    Here's my attempt, but if someone could verify, that would be helpful:

    To change:

    /yyyy/mm/blog-post-name to simply /blog-post-name, will this work?

    /\d+/\d+/(.*) => /$1

Reply

You must log in to post.

About this Topic