Forums

Permalinks structure not updating in database (3 posts)

  1. RoboPower
    Member
    Posted 6 years ago #

    Recently I updated my permalink structure from:

    /index.php/archives/%year%/%monthnum%/%day%/%postname%/

    to

    /index.php/%year%/%monthnum%/%day%/%postname%/

    However, I just went into the database, because I'm working with my host on another problem about 301 redirects in IIS, and I found out that none of my posts links that I made before the change were updated. The weird thing, is that the link to each post with the new permalink structure still works, even though the database lists that the link has "/archives/".

    Does anybody have a link describing how all this works? Also, when I hit "Update Permalink Structure" in Options -> Permalinks, is this supposed to update the database?

  2. Chris_K
    Member
    Posted 6 years ago #

    Can read more at the Permalinks page in the codex, but I'm afraid I have some bad news...

    Updating from one non-Default style to another non-Default won't affect your archives. It will, however, break any old links where you've manually linked in one of your articles from another. Those are not auto-updated.

    Does that answer it or am I missing some more subtle aspect of the question?

  3. RoboPower
    Member
    Posted 6 years ago #

    Thank you for replying HandySolo:)

    That's pretty close to what I was talking about, but I think I may have been a bit unclear, so let me explain a little more.

    I was actually asking two different questions, one I think you answered, but I'm not 100% sure. When I change my permalink structure from one non-Default style to another non-Default style, is that supposed to update all of my previous post links (guid attribute in the wp_posts table) in the database?

    Your second statement about breaking old links is relating to my second question, and what I've been pulling my hair out trying to figure out. Now that all of the old links are broken (no longer containing "/archives/"), how can I issue a 301 redirect to the correct link, so that my SEO isn't harmed? The hard part is that my host is running IIS. I know, change servers to Apache would be the easiest thing to do, but unfortunately that can't happen:(

    I would think that I could just write a php script that checks all inbound traffic URLs for the string, "/archives/" and removes it. However, I have no clue how I would do this and where I would put it.

    Is something like this along the lines of what I should do:
    http://www.stevenhargrove.com/redirect-web-pages/

    under "301 redirect using PHP"

    <?
    header( "HTTP/1.1 301 Moved Permanently" );
    header( "Status: 301 Moved Permanently" );
    header( "Location: http://www.new-url.com/" );
    exit(0); // This is Optional but suggested, to avoid any accidental output
    ?>

    How would I do something like this in my situation though? That is, how would I check for "/archives/" and redirect them to the link with "/archives/" removed?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags