Relative/absolute URLs and developing a site
I know this has been asked a number of times in this forum, but I’ve never had what I feel is a reasonable explanation as to why WordPress stores internal links (ie links to other content on then site) with the domain name, ie as full absolute URLs. Surely this makes the most standard web development workflow very brittle. This workflow is some variation on this:
Doing this breaks all internal links in wp_post.post_content as far as I can tell.
Surely the links should always be stored relative to the root of the site, eg:
I find it hard to believe I need to do a search and replace on the database before putting a site live, but after doing testing. This seems nonsensical to me as it is error prone.
Sure, for new sites with previously unused domains you can get away with this by putting the site behind a server level password for a while. But if you are doing a complete redevelopment of an existing site, there’s no way to test the final version of the content before putting it all live.
Excuse the long post, but I find this just so bizarre, that I am wondering if I am doing something wrong or if there is a way to alter my development methodology to avoid this problem?
Thanks in advance for any explanations and/or workarounds,
- The topic ‘Relative/absolute URLs and developing a site’ is closed to new replies.