Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Issues migrating WP from local to live server

So. I am having some sort of heinous issue migrating my wordpress site from a local to a live server. I have gone through the video a couple of times. I have even deleted everything and started over again. But for some reason after I have migrated everything, it gives me this gloriousness:

Not Found The requested URL /wp-login.php was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Every time. Is there an error that could be responsible for this?

2 Answers

Hey Maggie, the local-to-live WP migration is definitely not the easiest thing. As I do this pretty often, there are a couple things I know that are always important to do:

  1. After you migrate your database (aka, after you export/make a copy of your local database and import it onto your live server), you have to go into the live server db and change a couple of values. Open the wp-options table and check the first 2 fields, siteurl and home. What are the values of those 2 fields? If they have your local site's URL, then you need to change them to your live site URL. And remember to not include a trailing slash on the URL (in other words, write http://www.example.com, not http://www.example.com/).

  2. That change should allow you to at least access your live site's /wp-login.php page and log in. Once you're in, click the Settings link in the left sidebar, then go to Permalinks. Whatever option you want for your permalinks, choose that (or leave it where it is if that's preferred), and click "Save Changes" again. That may sound pointless, but WordPress actually rewrites your .htaccess file as a result of this Save, and will automatically reconfigure its rules based on the server environment it's now in (aka, it'll configure to your live server environment instead of your local).

  3. Presuming those 2 steps have gotten your live site working for the most part, there's one final step you need to do, which is to universally change any hard-coded absolute URL paths that WordPress set for any images or hyperlinks in any of your content. This is best solved with a plugin, and you can choose one yourself, but I regularly use and like one named Velvet Blues Update URLs that's simple, free, and does the job.

If doing these things doesn't get your live site up and running, let me know and I'll try to help you out further. Good luck!

Hey Eric,

I went into the wp-options table and changed the URLs, so now both the siteurl and the home are showing the correct URL minus any final slashes. I also double checked the wp_config file in the FTP and both the siteurl and home show the appropriate URL. Unfortunately, when I go to open the site or log in, I'm still getting the same error.

Maggie, The particular error message you're getting ("Not Found. The requested URL /wp-login.php was not found on this server.") is very specific. It means that when you FTP into the root folder of your website on your server, there isn't a file named wp-login.php sitting right there. Your challenge is to figure out why it's not there. Without having access to any specifics I can guess that there might be 2-3 ways that this might be:

  1. Is it because you actually have all your WordPress files all contained in a subfolder? If there's a folder in your server's root named, like, "wordpress" and all the WP files are in there, that's the problem; you need to put all the files directly in the site's root folder -- or else leave them in a subfolder and then specify in that wp-options table that your "home" is actually [your domain name]/[whatever the subfolder's name is].

  2. Or is it because you have a shared server (like GoDaddy etc.) and you didn't put the WP files in the right "root" folder? For GoDaddy and other shared-server setups, the "root" of your website is usually a folder called something like public_html. Is that where your wp-login.php file is? If not, that's the problem.

  3. Do you really have the WordPress files installed on your server at all? I expect this is an obvious yes, but it's good to at least confirm that the easiest answer isn't the right answer -- kind of like when tech support asks you if the computer is plugged in and turned on. :)

Anyway I really hope one of these is the answer so you can get on with the good parts of building out your site! Do keep me posted. Good luck.

THANK YOU SO MUCH! I had all the files in a subfolder, which was apparently causing the issue.

It's working now, and you are a fantastic human for helping me out!

Try plugin Duplicator, Easiest way to move wordpress.