Does WordPress not use relative URLs?

The articles/posts I’ve read about migrating WordPress between local/staging/live servers talk about having to migrating the URLs each time – is this true?

Or can you simply switch WordPress to use relative URLs?

Sorry if this is basic but hard-coded URLs make no sense so thought I’d check before following bad advice.

1 Answer
1

Out of the box WordPress uses absolute URLs. This requires you to make database updates when moving sites from development to production or when changing the base URL. I’m not sure why this choice was made but there are many options when moving sites.

  1. You can use a tool like WP Migrate DB Pro or another option that
    will work with serialized data to change the URL in the database
    after moving.
  2. Another option seems to be a plugin that changes that
    URLs to relative ones. It is up to date but I haven’t used it so I
    can’t endorse it. (https://wordpress.org/plugins/relative-url/)

Leave a Comment