WordPress.org

Ready to get started?Download WordPress

Forums

301 Redirect help (3 posts)

  1. jdflyer
    Member
    Posted 1 year ago #

    OK, I know this has been gone over ad nausium but I am still struggling with it.

    We have changed our website and are now using wordpress for the entire site instead of just one directory. One of the things that we have changed is the link for all the older posts.

    This is the way it used to be...
    http://www.oursite.com/blog/<year>/<month>/<name_of_post&gt;
    It has now been moved to...
    http://www.oursite.com/<name_of_post&gt;

    I know i could use
    RedirectMatch 301 ^/blog/2010/05/(.*)$ http://www.oursite.com/$1
    plus another one for the location of the graphics for each posting
    for each year and month combination, but that would lead to tons of 301's. Is there a better way to do this?

  2. jmdaix
    Member
    Posted 1 year ago #

    Hi,

    try to only modify with one line of code for each year with something like this :

    `RedirectMatch 301 ^blog/2010/.*/(.*)$ http://www.oursite.com/$1

    The first .* is for the month.

    Didn't try it so tell me if it works.

  3. jmdaix
    Member
    Posted 1 year ago #

    Sorry good version :

    RedirectMatch 301 /\d{4}/\d{2}/(.*) http://www.oursite.com/$1

    \d{4} is for the year and \d{2} for the month.

Topic Closed

This topic has been closed to new replies.

About this Topic