How can I change WordPress domain from remote to localhost?

I recently had a system crash and had to reinstall WordPress with my backup files.

In the JavaScript log I began throwing errors pertaining to the domain and realized I was still using the remote servers URL. So, I read the Changing the Site URL article in the WP Codex and added the following two lines to my config.php file:

define('WP_SITEURL','http://localhost:3000');

define('WP_HOME','http://localhost:3000');

If I go to localhost:3000 in my browser, it goes instead to localhost and loads the Apache server It works! page. However, I am using PHPs built in server. So please don’t drag Apache into this.

I do have the ability to go to localhost:3000/wp-admin and login with admin credentials, however when I try to click any of the admin links, I get a 404 not found:

The requested resource resource name was not found on this server.

Everything was working before the system crash, and I’m fairly confident I started the PHP server in the appropriate directory. Will someone viewing this both tell me how to fix this error, but also more importantly, explain why I can’t visit my local version of the site?

Any assistance will be much appreciated. Thanks.

3 Answers
3

Instead of renaming, set up your local web server to handle requests to that domain and modify your local hosts file to associate the domain with ip 127.0.0.1.

Especially when debugging hard to find bugs you will want your enviroment to be as similar to the one of the live site.

(I can do it in a not very modern version of WAMP and therefor I assume you can do it with all similar web servers)

Leave a Comment