• Resolved wperic

    (@wperic)


    I’m duplicating a site on localhost for development purposes. Whenever I try to access wp-admin it takes me to the live site. Where in the files is the link that I would have to change?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter wperic

    (@wperic)

    I think maybe the problem was that I called my localhost site with the .com extension. In any case I’m just going to create a fresh localhost site without the extension.

    Well that doesn’t solve the problem… As soon as I try to go to wp-admin it jumps right out to the live site on the internet.

    Thread Starter wperic

    (@wperic)

    I found this thread, which looks like it’s dealing with my issue: https://www.ads-software.com/support/topic/migrating-wordpress-site-to-new-server-and-new-url/

    Just to be sure, when I change the DB, replacing ‘olddomain.com’ with ‘newdomain.com’, following barnez, do is use ‘localhost/newsite’ as my ‘newdomain.com’ where ‘newsite’ is the name of the directory in /html where WP is installed?

    Thanks.

    Moderator bcworkz

    (@bcworkz)

    Yes, if you want to use local resources, all the related URLs in the DB would need to be updated. Better Search and Replace is a good way to accomplish this. Before doing that though, there is an alternative. You could edit your computer’s hosts file to interpret old domain requests as localhost (IP 127.0.0.1) requests. Then you needn’t change any DB data. The drawback is you’ll no longer be able to access the real old domain site from that computer, unless you remove the hosts entry. This is a great solution for some, others hate it.

    It’s not a bad solution if you have another computer you can use to access the real old domain, or you don’t mind editing hosts and restarting the computer every time you want to switch. N.B: It is necessary to do a restart anytime you edit the hosts file. One big advantage in my mind is you can migrate your local DB back to production without having to do another search and replace. (not that search and replace is that big of a deal) Bear in mind that any changes to production after you’ve duplicated the DB to localhost will be lost when you migrate your local DB back to production. Attempting to somehow sync or merge changes is a headache and it’s best to avoid the need.

    Hosts file location varies by O/S. Do an internet search to find out where it is for your specific O/S. To add a domain name to hosts for local access, add a line similar to:
    127.0.0.1 old-domain.com

    Thread Starter wperic

    (@wperic)

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘access wp-admin on localhost’ is closed to new replies.