Knowledgebase:
Wordpress site with divi theme breaks after hostname change
Posted by rbTech Staff, Last modified by rbTech Staff on 19 January 2015 03:07 PM

We recently built a website with excellent help and guidance from our friend Carter at figrig (http://www.figrig.com).  After we did all of our behind the scenes tweaks and modifications, and lots of testing, we were ready to move the site to it's permanent home.

We'd tested the site, and did all the usual backups of configs and MySQL database, but the divi theme would not work on the new hostname.  After a lot of google searching, we found a very helpful pointer on the Wordpress forums that mentioned that the variable names are 'serialized' in the database, meaning that the length of the variable is stored along with the string [1]:

s:9:\"divi_logo\";s:65:\"https://newsite.domain.tld/wp-content/uploads/company-logo-300x85.png\";
s:12:\"divi_favicon\";s:57:\"https://newsite.domain.tld/wp-content/uploads/favicon.png\";

Above, you can see values that are stored: divi_logo is the string, and the s:9: says it's a string with a length of 9 characters. Similarly the divi_favicon string is a length of 57 characters, and the URL is stored as well.

The trouble we ran into was that our development environment was set up as 'newsite.domain.tld', and the production URL was to be 'www.domain.tld'.  See the problem?  newsite.domain.tld is an 18 character string, while www.domain.tld is a 14 character string.  So when we did our global search and replace in the database dump to change 'newsite.domain.tld' to 'www.domain.tld', it made those values invalid because the string length didn't match the value in the database.  This resulted in the divi theme throwing out all of our settings, and reverting to an unitialized theme with no settings.

The fix was simple enough - correct the string length stored in the database.  Ultimately there were only 2 that needed updated: divi_logo and divi_favicon.  I searched the mysqldump file for those variables, changed the string lengths, re-imported the dump and voila!  The site came up as it should, with our Google analytics code and other settings where they belonged.

[1] https://wordpress.org/support/topic/theme-delicate-theme-options-lost-when-moving-to-new-domain

 

(6 vote(s))
Helpful
Not helpful

Comments (4)
Rebecca Miller
07 January 2017 07:39 PM
Hello,

Thank you for explaining this problem! I am not a professional and have created a site on divi and then changed the url once the site was built. I have the same problem with the favicon/logo and also some other media items. Can you explain in more detail how to change the information in the mySQL database? I've never worked with the database before and can't find where the logo (to start with) is stored. I did a search for "logo" and nothing came up. Thank you so much for your help!
Steven James
12 May 2017 06:03 PM
Thank you! You're the only person I found offering this solution--and it's the only solution that worked for me. I'd be lost without this post.
Alex
02 February 2018 08:56 AM
Hi I have also face the same issue
My theme is Divi, my all style are reverted even navigation.
The problem is that my WordPress call from subfolder abc.com/demo as a domain and when I change the domain abs.com/demo to abc.com then my all Divi theme configuration revert.
what is the issue behind this?
ohrs
30 October 2018 05:00 PM
hi,

i have this problem too. not only for divi theme. it's a word press thing and a bad practice.
my complete settings are reset to default after changing the values :/

Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).