WordPress.org

Support

Support » Requests and Feedback » Please Remove Absolute URLs from WP

Please Remove Absolute URLs from WP

  • 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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • WP uses absolute URLs for images, and that should be it. The rest are generated from your database.

    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.

    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 😉

    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.

    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.

    Move WordPress to a new domain in 10 easy 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.

    Vivat Regina

    Do I get to be Mary Queen of Scots? 🙂

    Mary I of England more likely

    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.

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Please Remove Absolute URLs from WP’ is closed to new replies.