Moving WordPress - Advice Please

The old website (non WP) is located here:

http://allamericanfieldservices.com

The temporary location for the new website is here:

http://allamericanfieldservices.com/newsite/

What is the best process for replacing the old website with the new one?

  • ryangambrill
    • The Incredible Code Injector

    Sorry about that. You might have checked the site while files were being transferred.

    Wp Files:

    I moved all files from the /newsite/ directory and they are in the correct location.

    MySQL Database:

    I did not move the database. Did not think this is necessary as everything is on the same server.

    - Next I verified that all of the database info was correct in wp-config.
    - Then used PHPMYADMIN to update the records in the database with the new correct URL (switched from domain.com/newsite/ to domain.com

    The site is resolving, but styling is not correct. Not sure what to do from there. Any help is appreciated.

    http://www.allamericanfieldservices.com

  • phillcoxon
    • The Crimson Coder

    The easiest way to move a WordPress site to a new URL is using a plugin like Backup Buddy which will convert all references to the original URL to the new URL in the database, confiig files automatically.

    I use it all the time and can generally clone / move a WordPress site in less than 5 minutes.

    I've just found out about this free plugin BackWPUp which I've been told will restore websites to a new URL.

    However, there is no mention of that in the plugin description and I haven't tested it yet. It would be worth checking out.

  • phillcoxon
    • The Crimson Coder

    Go into your child theme folder and edit style.css

    Make sure the path in your style.css to the parent theme style.css no longer has "newsite" in it.

    That's my guess. Once you update the child-theme style.css to properly map back to the parent theme style.css it should all come right.

    Give that a try and let me know how you get on.

  • Imperative Ideas
    • HummingBird

    Ryan. If the automated move does not work (they almost always leave issues behind) then the steps are more or less as follows.

    1. Export your posts
    2. Copy your wp-content folder to the new server location
    3. If you are changing web hosts, update your .hosts file to the new IP (temporary)
    4. Import your posts
    5. Configure your theme & plugin files
    6. You may need to run a couple of SQL commands to update your post/image locations:

    UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

    UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

    7. This may not update images set inside of custom post types, which is problematic. Jigoshop/Woocommerce in particular like to leave images in the old location.

    8. Check EVERYTHING for references to the old site. Change them manually if you must.

    9. Take your new site live. Fix your hosts file.

  • phillcoxon
    • The Crimson Coder

    Sorry - to clarify with the child theme. The full path won't be there but you'll see it reference the parent theme using ../../../ which translates to "go up a directory".

    Since you've moved from the /newsite folder to the / ("root") folder, try taking out one set of ../ and it should work.

    Again it's hard to guarantee that it will without access to the server to see what's happening.

    The permissions error referencing /newsite/ suggests that the URLs in your database haven't been updated.

    @Imperative Ideas' suggestion will work but you have to be VERY careful making direct changes to the database. One slip up and the database can be corrupted.

    Better to use: this plugin

    Please make sure you have full backups first either way.

    This is where investing in something like Backup Buddy pays off very quickly - it removes all of these headaches when moving sites.

  • ryangambrill
    • The Incredible Code Injector

    Ok. Was away and now back to this problem. Trying to resolve. A little scared that I painted myself into a corner.

    Attached is a copy of the style.css from the child theme folder. I removed the "../" from the path and tried to load the site. Did not fix the problem. Then added it back.

    It is my own fault has I have been away from this for a few weeks and it is difficult to remember my state of mind when I was pulled away.

  • aristath
    • Recruit

    Hello there @ryangambrill, I hope you're well today!

    The issue is indeed that your WordPress tries to load some of your resources from /newsite.
    The simplest solution I can think of would be to use .htaccess rules to redirect all calls from /newsite/* to /*
    You can do that by adding somethink like this in your .htaccess file:

    //301 Redirect Entire Directory
    RedirectMatch 301 newsite(.*) /$1

    P.S. I'm not a regex expert and I used the script from this page to generate that code:http://www.htaccessredirect.net/index.php it should work...

    I hope that helps!

    Cheers,
    Ari.

  • ryangambrill
    • The Incredible Code Injector

    I added those lines to the HTAccess file.

    Now getting: "500 Internal Server Error"

    Here is a snapshot of the HTACCESS:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /newsite/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /newsite/index.php [L]
    </IfModule>

    //301 Redirect Entire Directory
    RedirectMatch 301 newsite(.*) /$1

    # END WordPress

    Thoughts?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.