Forums

Please Remove Absolute URLs from WP (11 posts)

  1. Tandem
    Member
    Posted 1 year ago #

    Please change WP to use only relative paths throughout the system.
    The code and all entries in DB should be site-independent. WP should work no matter what domain it is located on. If WP really needs to know the site URL it should be set only in one location, preferably in the config file.

    I am considering to start using WP to develop websites, but the steps that are necessary to move WP site between Dev, Test and Live environments makes me hesitate.

    I am not aware of any other CMS that has this problem.

  2. WP uses absolute URLs for images, and that should be it. The rest are generated from your database.

  3. Tandem
    Member
    Posted 11 months ago #

    I am not sure what you mean by: 'The rest are generated from your database'.
    WP uses absolute URLs for everything. I am working on a simple site with 13 pages, no posts, only few images and internal links, yet the DB has 400+ occurrences of http://DomainName.com

    Every time you move your site you have to do a mass find and replace for anything to work in your new location.

  4. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 11 months ago #

    The permalinks for your site, from an archive or category or tags page, are dynamically generated.

    The only absoulte URLs would be twofold, now that I think about it.

    1) Images. Yes, we know, there's been no better way to support the majority of sites yet.

    2) Internal links you created manually.

    Everything else, though, if you use the dynamic links in menus and archives, are indeed dynamic and don't need to be changed.

    Mind you, YES, if you move your site to a new domain, you ALWAYS should search/replace olddomain/newdomain. That's just sensible :) And listed in the codex ;)

  5. Tandem
    Member
    Posted 11 months ago #

    The suggestion was to make the migration of a WP site between different locations easier by making the extra step of find and replace through the DB unnecessary.

    The site admin should be able to move or copy WP site from one server to another by just copying the file structure, exporting the DB and changing the DB info in the wp-config.php file.

  6. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 11 months ago #

    Not going to happen.

    Images are absolute URLs. End of story. They just are. Yes, it sucks, yes it SHOULD be better, but as of yet, it's not. Because of that alone, you will always need to search/replace. Sorry.

    http://yoast.com/move-wordpress-blog-domain-10-steps/

    I will point out that it's a good thing to do anyway, for ANY site on any software. You never know where someone (maybe you, maybe someone else) hard coded in something they shouldn't have.

  7. Tandem
    Member
    Posted 11 months ago #

    Vivat Regina

  8. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 11 months ago #

    Do I get to be Mary Queen of Scots? :)

  9. Tandem
    Member
    Posted 11 months ago #

    Mary I of England more likely

  10. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 11 months ago #

    I'd rather be Anne Boleyn. I get a fun song.

    Anyhow. If you want to see some older (and still valid) discussions on the matter, check http://wordpress.org/support/topic/using-relative-instead-of-absolute-links-for-images

    Also here's a feature req for in-page URLs to be relative: http://core.trac.wordpress.org/ticket/6599

    Otto's one of the devs.

    I'm really just the messenger with a fun title.

  11. bhus
    Member
    Posted 11 months ago #

    I would like to help out with this. Perhaps writing a script that would move root domain name?

Topic Closed

This topic has been closed to new replies.

About this Topic