The MU forums have moved to WordPress.org

Forced /blog/ permalink for Main Blog (9 posts)

  1. johnsee
    Member
    Posted 17 years ago #

    I've just upgraded to RC4 from a copy of WPMU serveral months old. I've got everything working flawless, but for my main blog it now seems to want to force me to have /blog/ in permalinks for posts.

    I've edited the "permalink_structure" value in the database to remove the /blog/ prefix, but this just changes the links on the site, and doesn't cause the pages to physically work again.

    Any ideas? It worked fine on my old build :(

  2. johnsee
    Member
    Posted 17 years ago #

    Somehow I fixed it.. I'm not even sure how :(

    I screw around for hours with no avail... then i post here... and it fixes itself 3 minutes later :/

  3. thatposhgirl
    Member
    Posted 17 years ago #

    Sometimes the htaccess is cached and it needs a chance to clear for changes to permalink structure to take effect.

  4. mihaigrigori
    Member
    Posted 16 years ago #

    I have the same problem. However changing the permalink_structure, category_base and rewrite_rules in the options table doesn't seem to help.
    The links are displayed how I want them (without the '/blog' prefix) but they don't work. Opening a single article permalink or category permalink will display the homepage content.
    Adding the 'blog/' suffix will make the url return a 404.

    Any idea how to get rid of this 'blog/' suffix?

  5. mihaigrigori
    Member
    Posted 16 years ago #

    I think I've found something for this. This can work as a plugin that will remove the 'blog/' suffix

    function wpdate_rewrite_rules_array($wp_rw){
        $wp_rw_tmp = array();
        foreach($wp_rw as $k=>$v){
            $k = preg_replace('#^blog/#','',$k);
            $wp_rw_tmp[$k] = $v;
        }
        $post_permalink_structure = get_option('permalink_structure');
        $post_permalink_structure = preg_replace('#^/blog/#','/',$post_permalink_structure);
        update_option('permalink_structure',$post_permalink_structure);
    
        $category_base = get_option('category_base');
        $category_base = preg_replace('#^/blog/#','/',$category_base);
        update_option('category_base',$category_base);
    
        return $wp_rw_tmp;
    }
    add_filter('rewrite_rules_array','wpdate_rewrite_rules_array');
    

    Permalinks need to be updated in order for this to have effect.

  6. lunabyte
    Member
    Posted 16 years ago #

    /me

    I just cut it off from the source, as it's much easier than having all that above parsed every time. 2 little edits and it's done.

  7. softlord
    Member
    Posted 16 years ago #

    lunabyte: can you describe what you did to resolve this?

  8. ladynada
    Member
    Posted 16 years ago #

    I would like to know what lunabyte did also

    nada

  9. ladynada
    Member
    Posted 16 years ago #

    I fixed my problem with a custom fix described on another thread
    http://mu.wordpress.org/forums/topic.php?id=3672&page&replies=15

    nada

About this Topic

  • Started 17 years ago by johnsee
  • Latest reply from ladynada