Change WordPress URL in database

Annexe

This post originally appeared on the Annexe.

Yes, I’m turning this Tumblr into a dumping ground for stuff that’s not worth putting on my actual blog :)

If you’ve changed your URL in nginx/Apache, and need to modify in the database:

USE wp_database;
BEGIN;
UPDATE wp_options 
SET option_value='http://example.com'
WHERE option_name='siteurl';
UPDATE wp_options 
SET option_value='http://example.com'
WHERE option_name='home';
COMMIT;

DISCLAIMER: I have used reasonable care in preparing the information included in this document, but I do not warrant that such information is error free. I assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein. Backup all production databases before modification.

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person in bios. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.