The MU forums have moved to WordPress.org

Category, Tag Base - upgrade issue (8 posts)

  1. jennblambert
    Member
    Posted 15 years ago #

    Hi -

    I've upgraded from 2.6.5. I need help to learn how to remove category_base, tag_base, custom structure references to an erroneous "blog." Also, proper settings for wp_1_options. And these questions are just our final guess as to why the site's url's are whacked. Help appreciated - site is effectively down!

    ISSUE: all of my posts (eg http://www.chefsline.com/blog/category/postname) return a 404. When using link http://www.chefsline.com/blog/BLOG/category/postname, they load. Note TWO instances of blog. References to pages work fine. Seems to be post and tag issue.

    In http://chefsline.com/blog/wp-admin/options-permalink.php what shows is Category base=/blog Tag base=/blog.

    I removed "/blog" from file wp-admin/options-permalink.php but the change is not showing in admin panel.

    Mysql tabe wp_1_options category_base and tag_base are blog_id=0, autoload=yes, option_value = blank. (Should blog_id=1?)

    Overall, we have changed and tested: permalinks, htaccess, wp-Config, siteurl, and home.

  2. sozomai
    Member
    Posted 15 years ago #

    The problem here is that under the sites admin - blogs - edit options you can change the permalink options but I believe there is no function here calling for the rewrite of the .htaccess file. Whereas if you use the settings permalinks page it is automatically coded to insert "/blog" as the base for your urls. So what we need to do is change the permalinks page to get rid of that extra coding. I explain how to do this below. I should note though that we are playing with fire here. And although this worked for me I'm a newbie to php code and can't predicate possible reprecussions.

    The file you want can is:
    wp-admin/options-permalink.php

    if you want to get rid of that base name altogether delete or comment out the following lines:
    82 - $permalink_structure = '/blog' . $permalink_structure;
    92 - $category_base = '/blog' . $category_base;
    102 - $tag_base = '/blog' . $tag_base;

    if you prefer simply to change it from "/blogs" to "/site" simply replace "blog" in all three lines with "site"

    This has changed the actually operation of the site, now we have to change the way the permalinks option page looks to reflect what it is actually doing.

    to do this find the following line:

    185 - <?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $permalink_structure = str_replace( "/blog", "", $permalink_structure ); }?>

    Here you need to either delete or comment out JUST THE LAST PART of the line name: { echo "/blog"; $permalink_structure = str_replace( "/blog", "", $permalink_structure ); }

    or again to change from using "blog" to using using "site" replace BOTH instances of "blog" with "site"

    repeat this same process with the follwing two lines, but notice that on these two lines the code in question comes in the middle of the lines. Both the code before it and after it needs to remain untouched.

    201 - <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $category_base = str_replace( "/blog", "", $category_base ); }?> <input name="category_base" id="category_base" type="text" value="<?php echo attribute_escape( $category_base ); ?>" class="regular-text code" /></td>

    205 - <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $tag_base = str_replace( "/blog", "", $tag_base ); }?> <input name="tag_base" id="tag_base" type="text" value="<?php echo attribute_escape($tag_base); ?>" class="regular-text code" /></td>

    Now you can upload the file to your site - go to settings - permalinks; change it to your desired permalink settings and save. Your site should now be working correctly.

    Assuming you chose the comment out option the final code in options-permalinks.php should look as follows

    82 - // $permalink_structure = '/blog' . $permalink_structure;

    92 - // $category_base = '/blog' . $category_base;

    102 - // $tag_base = '/blog' . $tag_base;

    185 - <?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) // { echo "/blog"; $permalink_structure = str_replace( "/blog", "", $permalink_structure ); }?>

    201 - <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) // { echo "/blog"; $category_base = str_replace( "/blog", "", $category_base ); }?> <input name="category_base" id="category_base" type="text" value="<?php echo attribute_escape( $category_base ); ?>" class="regular-text code" /></td>

    205 - <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) // { echo "/blog"; $tag_base = str_replace( "/blog", "", $tag_base ); }?> <input name="tag_base" id="tag_base" type="text" value="<?php echo attribute_escape($tag_base); ?>" class="regular-text code" /></td>

  3. texet
    Member
    Posted 15 years ago #

    thank you - this hard-coded /blog is a "feature" that some people probably find less annoying. :-)

  4. andrea_r
    Moderator
    Posted 15 years ago #

    And it's worth it to note that this is a hack, so you'd have to re-do it with each upgrade.

  5. kuwaitman
    Member
    Posted 15 years ago #

    i tired this trick it works.
    i replaced the word /blog with /news for all the lines in wp-admin/options-permalink.php.
    so now the permalink looks like that http://mysite.com/news/category/postname/
    but now if i post a new post and go to http://mysite.com/news/
    i get the fallowing
    "Sorry, that page was not found"
    "The page you were looking for was not found."
    but if i go to http://mysite.com/news/category i find the new post there.
    how to make new posts appear in the main page /news?
    i tired almost everything i even found a new file that contains
    $permalink_structure
    it's index-install.php in the main folder and replace /blog with /news
    but still i can't seem to figure out to to change it.
    if anyone have an idea please let me know.

    Regards

  6. andrea_r
    Moderator
    Posted 15 years ago #

    Make an empty Page in the backend called "News". Go to Settings _> reading and click the option to show posts on a page. Then pick "News".

  7. memitch08
    Member
    Posted 14 years ago #

    So Andrea -

    Are you saying that for the main site - the category page will always be /blog/category/?

    That's kind of annoying. Is there anyway to fix this -without the hack above?

  8. memitch08
    Member
    Posted 14 years ago #

    This plugin did the trick: Link

About this Topic

  • Started 15 years ago by jennblambert
  • Latest reply from memitch08