WordPress.org

Ready to get started?Download WordPress

Ideas

Relative instead of absolute URLs!

  1. wakester
    Member

    12345

    Absolute(long) image URLs <img src="http://testserver/path/to/media.jpg"> are bad when moving a site.

    Can a future version use Relative URLs pretty please??? :)
    <img src="/path/to/media.jpg">

    When you migrate a site from an old URL to a new URL, you have to do a mass find and replace to change all the image src's! :(
    I just had to do one with over 6,500 img src's.

    P.S. I'd be glad to help test this! :)

    Posted: 2 years ago #
  2. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod

    Maybe later - https://core.trac.wordpress.org/ticket/17048

    Posted: 2 years ago #
  3. converting2wp
    Member

    Yes, please. At the end of that *long* (and sometimes heated) discussion on trac, there was a link:
    http://wordpress.org/extend/plugins/root-relative-urls/

    That sounds *wonderful* (my problem is usually one of building out a site upgrade in a dev environment and then wanting to transition to production).

    It's not clear how long it'll be maintained (says supports up to 3.2.1) and the discussion is still heated:
    http://wordpress.org/support/topic/plugin-root-relative-urls-fyi-im-currently-adding?replies=7

    Posted: 1 year ago #
  4. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod

    That sounds *wonderful* (my problem is usually one of building out a site upgrade in a dev environment and then wanting to transition to production).

    There are other ways around this, including simple search/replacing your dev URL for the prod one, or using something like your hosts file to mimic the URL so you can just copy up.

    Posted: 1 year ago #
  5. converting2wp
    Member

    Yes, I've been doing this so I have found workarounds.

    One note for others who might be interested is that search/replace on the .sql file has been problematic for me -- usually with problems in serialized data and/or because my old text editor mangles utf-8 content. So I usually do the search/replace via phpMyAdmin limited to specific columns of specific tables.

    Also, I try to enter image and internal post/page URLs as root relative -- but that means the new way of adding links to internal pages/posts isn't all that helpful.

    Posted: 1 year ago #
  6. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod

  7. converting2wp
    Member

    You rock! It's been a couple of years since I changed my process (and looked for updated tools) -- but I'm about to head into a "month of WordPress" to update a half-dozen sites and this looks like it'll definitely help. Will try to keep up the "answer 5 for each 1 you ask" on the Forums.

    Posted: 1 year ago #
  8. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod

    Right on :D

    Posted: 1 year ago #
  9. eschwartz93
    Member

    12345

    I like this idea to. At the moment I can see how it's not important compared to the REALLY critical issues, but we shouldn't need to use a plugin for this, and honestly I would find it cleaner to read the source. There is no good reason why we need the absolute url anyway. its already pointed at the right site.

    Looking forward to this change someday in the future.

    Posted: 1 year ago #
  10. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod

    There is no good reason why we need the absolute url anyway.

    There are many valid, technical, reasons why we use absolute URLs.

    Posted: 1 year ago #

RSS feed for this topic

Reply »

You must log in to post.