IP Change breaks the site?

So my site seems to have broken after a failure of the modem caused us to change to a new one, which in-turn changed the ip of the building.
The site wouldnt come up at all at first. I have the site url etc in the wordpress settings set to our ip, I ended up going in to mysql and changing every instance of the old IP to the new IP in every table. This fixed almost every problem, except pictures. Any pictures I added via the upfront editor, do not work. However the Huge IT sliders do, but I changed everything in their table to our new ip.

Upon inspecting the elements, they clearly show the original IP linking them to the image. and not the new IP. So my guess is that the image locations for the various pages are set on a file somewhere or multiple files. Where can I go to finish resolving this issue. It seems everything else works. And the upfront editor will load, and I am sure I can manually add the pictures back and it will correct this.

But the site is getting big and this will happen again when I go to migrate the site to the final server. Or if we lose our ip some how. Is there a config file or where can I find the files that let the site know where the storage locations of these images are. So I can just replace every instance of the old IP and fix this issue much quicker?

  • Adam Czajczyk

    Hello Chris,

    I hope you're well today and thank you for your question!

    Upfront loads pictures to the Media Gallery so I assume you managed to deal with that part. I suppose though that some of the images that you are referring to are most likely used for Upfront layouts (as parts of design), is that right?

    Upfront doesn't store data in files but in database only. However, data is serialized and can be sometimes omitted by some of the plugins used for updating URL's in database. Did you use a plugin for this (e.g. Velvet Blue Update URLs or similar) or did you make changes "manually"?

    I'm pretty sure that some of the URLs (serialized ones) were just skipped so I think you should give this script a try:

    https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

    It's not a plugin but the standalone script, however it's easy to install and use (it's well documented on page) and it can easily change serialized data. It didn't let me down so far :slight_smile:

    You may want to first try with "Dry run" tool and it will show you if there are some missed IPs indeed. Then give it a go and it should update everything.

    As for avoiding this in future. I think there's another option: you could use a service such as e.g. "noip.com" to grab a temporary (free) host name that can be updated to an IP with just a click. If you would set your WP to that "domain" that you get you would be safe from similar issues in future. Furthermore, you would also be able to set access to the site "from outside" easily if necessary.

    Best regards,
    Adam

  • Christopher

    I manually went into the MySQL db using heidiSQL (took a backup first just in case i was about to break everything), and searched every table for each instance (using the find and replace function) of my old ip and replaced only the ip portion in all the various strings with my new ip.

    This seemed to fix everything but the pictures it uses on the sites, however the backgrounds seem to load o.0 at least on the pages I tried, and various other plugins seem to be fine but the pictures added on using upfront are dead and still pointing at the old IP.

    Also I just now exported all of the tables into an sql file and found only two more instances where it seems it would of been on page two of the table I was doing the replace on. Apparently I didn't catch these two because I never checked the next page of data. However, after fixing that, I exported again and all the old IP's have been replaced, but it is still not working.

    Going to look into this script. But If I am understanding the title at least, It seems like its doing the same thing I am but with a script to do it automatically. Maybe not though ? o.0

  • Adam Czajczyk

    Hello Chris,

    Thank you for your replay!

    Going to look into this script. But If I am understanding the title at least, It seems like its doing the same thing I am but with a script to do it automatically. Maybe not though ?

    It is actually doing the same and I suggested giving it a try only because from my own experience (both personal and from helping members of our community here) I know that it often deals well with cases that other tools were not able to deal with.

    I would give it a shoot anyway, just to be 100% sure that everything is changed. After that, I'd also go to the "Upfront -> General" page in site's back-end and used the "Reset Upfront Cache" button. Internal Upfront cache is not very persistent but in case of updates and changes like this it can interfere.

    If none of that helps, let me know please and I'll investigate it further.

    Best regards,
    Adam

  • Mark

    Hi There,

    I have also had this problem, where the site was originally installed ona site with siteulr and home adress set as an IP and then subsequently moved to another ip or domain and I have been unable to fix it.

    I used mysqldump and searched manually for values in the db containing the offending ip address (the address of the original install) without any success.
    I then used the database search and replace script you mentioned above also without any success.

    It seems there are no strings containing the old ip address in the whole database, yet when I go to the site, the image urls in particular upfront elements have retained the old ip address.

    Eg images in the gallery element. (I'm using upfront fixer)

    There is a lot of this sort of thing in wp_posts => post_content:

    YTo4OntzOjQ6Im5hbWUiO3M6MDoiIjtzOjEwOiJwcm9wZXJ0aWVzIjthOjk6e2k6MDthOjI6e3M6NDoibmFtZSI7czoxNjoiYmFja2dyb3VuZF9jb2xvciI7czo1OiJ2YWx1ZSI7czowOiIiO31pOjE7YToyOntzOjQ6Im5hbWUiO3M6NDoiZ3JpZCI7czo1OiJ2YWx1ZSI7YTo0OntzOjEzOiJjb2x1bW5fd2lkdGhzIjthOjE6e3M6NzoiZGVza3RvcCI7aTo0NTt9czoxNToiY29sdW1uX3BhZGRpbmdzIjthOjE6e3M6NzoiZGVza3RvcCI7czoyOiIxNSI7fXM6OToiYmFzZWxpbmVzIjthOjE6e3M6NzoiZGVza3RvcCI7aTo1O31zOjEzOiJ0eXBlX3BhZGR

    Is it possible that upfront has stored the values I'm looking for in the db in some form of encrypted code?

    Thanks - Mark.

  • Predrag Dubajic

    Hey guys,

    Just had a chat with the UF devs about this and something like this should do the trick:

    update yourdatabase.wp_posts
    set post_content = to_base64(replace(from_base64(post_content), '127.0.0.1', '127.0.0.2'))
    where from_base64(post_content) like '%127.0.0.1%'
    and post_type like 'upfront_layout%';

    IMPORTANT: Make sure you have a backup ready before trying that out, and of course make sure to use correct IP's, 127.0.0.1 is old IP and 127.0.0.2 is new one.

    Best regards,
    Predrag