• Resolved bonda

    (@bonda)


    I have a new WP installation in the folder called “new”, but there are many sites and search engines out there that keep on pointing to the old URLs (the old WP was in the root dir).

    Old post URLs:
    www.domain.com/year/month/day/category/post-title/
    New WP installation’s posts URLs:
    domain.com/new/post-title/

    The post titles are the same.
    How could I redirect them all at once to the new URLs?

    I have tried the Redirect plugin, but the old WP installation is corrupt and doesn’t work properly.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Some useful htaccess redirect rules here you could try:
    http://perishablepress.com/stupid-htaccess-tricks/#red3

    Thread Starter bonda

    (@bonda)

    Thank you, Barnez. I have tried both of their examples, but they don’t work in my case (“Page no found”). They suppose that inside the new directory the path is of the same type (year/month/day/category/post-title), and it’s now simply *.com/new/post-title

    This one works:

    Redirect permanent /2010/05/14/news/ http://wariscrime.com/new/

    But the problem is how to make it work for ANY year/month/day…

    Thread Starter bonda

    (@bonda)

    Thank you. After a series of tests, this one works:

    RedirectMatch 301 ^/[0-9]{4}/[0-9]{2}/[0-9]{2}/([a-z0-9\-/]+) http://wariscrime.com/new/$1

    Fantastic news! Did you find the rule at Perishable Press?

    Thread Starter bonda

    (@bonda)

    Yes. But I didn’t know much about regular expressions before, so their examples were kind of Chinese for me. So, to adapt them, I had to learn a bit their meaning first. Fortunately, it’s all very well explained on the same page 🙂

    It’s a great resource, and congratulations on a courageous htaccess adaptation – we all know what happens when the code is flawed.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘htaccess redirect doesn't work’ is closed to new replies.