WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WordPress broke my internal links by translating them from absolute to relative (4 posts)

  1. kirkpete
    Member
    Posted 3 years ago #

    I've discovered that a bunch of internal links -- links from one of my blog posts to another -- have broken. As I go to try to fix the links, I see that the absolute links that I pasted into the editor when creating the post have been converted to relative links, presumably during an upgrade. And the relative links bust.

    Example:

    On http://blog.kirkpetersen.net/2009/07/im-betting-against-an-israeli-air-strike-on-irans-nuke-facilities.html, I have several internal links in a paragraph beginning "As a Bolton-loving, pro-Israel, Saddam-overthrow-approving neocon..." (I will be grateful for your help on this regardless of whether you agree or disagree with my politics.)

    The first link is supposed to point to:

    http://blog.kirkpetersen.net/2009/03/responsible-economic-policy-is-a-national-security-issue.html

    which was the absolute link I coded. Instead it points to:

    http://blog.kirkpetersen.net/2009/2009/03/responsible-economic-policy-is-a-national-security-issue.html

    ... with an extra "/2009" in the URL. Each of the other internal links in that paragraph busts for the same reason, and there are similar busted links on other pages.

    When I open the post in the editor, I see the link is coded thusly:

    <a href="../2009/03/responsible-economic-policy-is-a-national-security-issue.html">

    But I've never used relative links, I always cut and paste links from my browser's address field.

    Two questions:

    1. Is there a way to repair the links that is less tedious than opening up each affected blog post via the dashboard and editing each link one by one? and

    2. How do I keep this from happening again in a future upgrade? (If that indeed is how it happened.)

  2. Is there a way to repair the links that is less tedious than opening up each affected blog post via the dashboard and editing each link one by one?

    You could use a MySQL query to find and replace all instances of /2009 with http://blog.kirkpetersen.net/2009 but this could cause some "collateral damage" as all occurrences of /2009 will be replaced.

    How do I keep this from happening again in a future upgrade?

    There's nothing in the WordPress core to change links from absolute to relative. I'm going to guess that this was probably done by a plugin.

  3. kirkpete
    Member
    Posted 3 years ago #

    Ick. I officially hate plug-ins. But thanks.

  4. You're welcome!

Topic Closed

This topic has been closed to new replies.

About this Topic