• garfy

    (@garfy)


    I just moved my site to different domains but I cant even login so I could use search and replace module or something
    What to do?
    I ran this sql command, but it did not do anything..

    I wonder how to do it properly. what is the correct sql command?

    UPDATE wp_posts SET post_content=(REPLACE (post_content, ”yoursite.com, blog.yoursite.com”));

Viewing 10 replies - 1 through 10 (of 10 total)
  • jherz

    (@jherz)

    @garfy I usually use the tool found here: https://interconnectit.com/search-and-replace-for-wordpress-databases/. It works beautifully. Hope this helps ??

    abletec

    (@abletec)

    Hello, garfy, & welcome.

    There are several ways around this. 1 thing you could do is to get a script called Search-and-replace-DB by interconnectit, available from here:
    https://interconnectit.com/search-and-replace-for-wordpress-databases/

    Specifically, it has a command line interface script that can be used for this purpose, so you don’t need to log into your WordPress site.

    Unfortunately, as you’ll see if you visit the site, they pretty well require you to sign in blood that you know what you’re doing & they’re not liable if you screw it up. Jump through their hoops is all I can say.

    Truthfully, urls aren’t really serialized, & I’ve actually done a search-replace in a text editor & reimported back into the database, but it’s not recommended procedure. It does require that the encoding is the same between your editor & database, but that’s not a problem for most modern text editors.

    I can’t warn you enough to do backups. Yeah–I know–it seems kinda counterintuitive to back up something that’s already screwed up, but it’s always best to be able to go back to a known starting point if things go really south.

    Thread Starter garfy

    (@garfy)

    i wanted to do it in visual studio but the changes were not saved…..
    i am trying on notepad now….
    why is this so difficult with wordpress? How would you install a plugin search and replave if it redirects you to old domain?

    the script you gave is is scary, somebody can hack your site for sure

    jherz

    (@jherz)

    the script is scary and should always be deleted once you’re done using it, but it works. Also, I think if you just change the siteurl and home values in the wp_options table of your site’s database you should be able to log into to WP.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Use the plugin “better search replace”. It’s based on the same code.

    Thread Starter garfy

    (@garfy)

    ok i managed to replace all urls in notepad and reimport…..I got one error but db works, but still urls are pointing….is it because of cache? I use cachelesss browser….for this…so where is the problem?

    Thread Starter garfy

    (@garfy)

    better search and replace i used it before, but I cant even login, it redirects me immediately to old site, why wp does not use relative urls?

    abletec

    (@abletec)

    garfy, Please disable all caches & clear your browser as well.

    Please also tell us your site url.

    Thread Starter garfy

    (@garfy)

    i think now I know…i renamed cache folder inside wp content…so that must have done it
    is it safe to delete that folder?

    what I am worried it that there was error when importing website…tiny one, but still so probably notepad messed up database?

    Thread Starter garfy

    (@garfy)

    here is the error i get importing database with changed urls
    Error
    Static analysis:

    1 errors were found during analysis.

    Missing expression. (near “ON” at position 25)
    SQL query: Edit Edit

    SET FOREIGN_KEY_CHECKS = ON;

    MySQL said: Documentation

    #2006 – MySQL server has gone away

    is this serious?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘ALl urls redirecting to old site after migration’ is closed to new replies.