How to safely change a "key" wordpress_sites.yml?

Hi,
I started developing a new site, full stack Roots.
Installed everything, then vagrant up, and everything was fine.

But then, I saw in wp-admin that my site name was example.com instead of my url giladbenavi.com.
I went back to wordpress_sites.yml , and noticed that I forgot to change the site key from example.com to giladbenavi.com.
So I changed it, then vagrant reload, and…
when I went back to the browser, I had this nasty
500 Internal Server Error (nginx)

Next thing I did was to look inside /srv/www/giladbenavi.com/logs, but the error log was emty.
However, the error log in /srv/www/example.com/logs was active, and what I found in it were multiple occurrences of the following error:

2017/09/29 09:12:57 [error] 1552#1552: *11 rewrite or internal redirection cycle while internally redirecting to “/index.php”, client: 192.168.50.1, server: giladbenavi.dev, request: “GET /favicon.ico HTTP/1.1”, host: “giladbenavi.dev”, referrer: “http://giladbenavi.dev/

Can someone tell me what is going on here?

Is there a proper and safe way to change the site key in wordpress_sites.yml?

Thanks!

Have you performed a search and replace of the database? I recommend using WP-CLI’s wp search-replace function. wordpress_sites.yml controls the nginx config but doesn’t touch the database once it’s provisioned (as far as I know).

On the other hand if you haven’t done a ton of db modifications yet (it seems like you may not have) then you could always just do a vagrant destroy and vagrant up to start with a fresh install of wordpress, this runs the initial provisioning.

It’s also worthwhile to check that landrush is configured to spoof the new domain’s dns, vagrant landrush list.

Let me know where this gets you!

2 Likes

Thank you @gnowland

Since I haven’t done any db modification yet, I took your advice and did a vagrant destroy.
It solved the issue.

Glad to hear it! Most of the 500 errors I get are due to the wrong URL in the WordPress database site_url or home_url, etc. misconfigurations :slight_smile: