• Resolved picchio89

    (@picchio89)


    Hi!
    I’ve a wordpress multisite installation and I manage all the blogs.
    I would like to change my permalink structure on each blog, but ,off course, without lose traffic from page already indexed.

    the best solution I found is this article about seo http://yoast.com/wordpress-seo-url-permalink/
    they say I can add a simple code line to .htaccess
    RedirectMatch 301 /\d{4}/\d{2}/\d{2}/(.*) http://example.com/$1)

    It would work properly if I had a regular wp installation, but not on multisire:
    infact after put the line in .htaccess and change the permalink structure in /&postname%/ I get
    the post redirect on http://example.com/postname
    but I need http://example.com/BLOGNAME/postname

    how could I say /BLOGNAME/$1 in my .htaccess file???

    Something like:
    RedirectMatch 301 /\d{4}/\d{2}/\d{2}/(.*) http://example.com/BLOGNAME/$1

    cheers from Italy

Viewing 13 replies - 1 through 13 (of 13 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    I wonder if this would world:

    RedirectMatch 301 /\d{4}/\d{2}/\d{2}/(.*) /$1

    Thread Starter picchio89

    (@picchio89)

    Thanks Ipstenu,
    I tried but it doesn’t work.

    I get the same error above,like: http://example.com/postname without the blog path.

    is it possible it doesn’t exist a command that say “take the full path”????

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    Oh right, cause / starts at example.com … Hm.

    How does this work?
    RedirectMatch 301 /\d{4}/\d{2}/\d{2}/(.*) $1

    Thread Starter picchio89

    (@picchio89)

    I give you an real example:

    I’ve this url
    http://travellertribe.com/hamburg/2010/06/07/hafengeburtstag-hamburg/

    when I put
    RedirectMatch 301 /\d{4}/\d{2}/\d{2}/(.*) $1

    and than change permalink on /%postname%/

    if i go to
    http://travellertribe.com/hamburg/2010/06/07/hafengeburtstag-hamburg/
    I get
    http://travellertribe.com/hafengeburtstag-hamburg/

    as you can see I lost /hamburg/

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    No, I got that πŸ˜‰ I just am not in a place where I can play with .htaccess for that effect myself (work, today it’s all windows servers).

    The problem is that the match ($1) is automagically flipping back to the root URL (example.com) so you get example.com/replacement :/

    Other than doing a ton of these:
    RedirectMatch 301 /foobar/\d{4}/\d{2}/\d{2}/(.*) /foobar/$1

    I can’t think of a quick fix.

    Maybe this:
    RedirectMatch 301 /(.*)/\d{4}/\d{2}/\d{2}/(.*) /$1/$2

    But I don’t know if that would work. You may need to refine that first (.*) and tell it to look for A word, and not ‘anything’

    Before you put too much work into changing your permalinks to jujst postname, please read the following:

    http://ottopress.com/2010/category-in-permalinks-considered-harmful/

    Thread Starter picchio89

    (@picchio89)

    Thanks Andrea for the intresting article,
    but I’ve to change permalink in order to use a plugin too.

    @ipstenu you rock!
    I tryed your way and it works!!!!

    thanks again, cheers from Italy

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    FWIW, Yoast’s article, linked at the top, has some pretty valid arguments why %postname% should be fine for MOST people (who aren’t on bottom line hosting and use any caching tools). I always toss a ‘folder’ name in there, so I get domain.com/news/foo or domain.com/blog/foo, but really the point is this:

    If you understand what you’re getting into with short permalinks, and know how to handle it, you’re fine. If you’ve got no idea what it all means, for god’s sack, don’t do it!

    How about if I wanted to switch from domain.com/post/ to domain.com/category/post/? Recently did that and am attempting to repair my flood of 404’s. Tried permalink plugins to fix it but it seems I need to make an individual redirect for each 404 that comes in.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    THAT I would not do (/category/post/).

    If you do, however, you will need to redirect each post, because there’s no good way to detect the postname and parse for category.

    Ok, switched back to /postname/ now… how to I redirect the /%category%/%postname%/ requests back to /%postname%/? to fix the future 404 errors i’ll get from submitting my previous sitemap to google webmaster tools. Or will those just go away? (since I haven’t backlinked any of the new structure to 3rd party sites)

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    For each category:

    RedirectMatch 301 /categoryname/(.*) /$1

    Your help is

      much

    appreciated.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘write .htaccess to 301 to redirect post url befor change permalink structure’ is closed to new replies.