Error on Wordpress Admin URL after moving from loc

2019-07-10 16:14发布

问题:

I have created a WordPress project in my localhost, this is working.

I sent my project to git repository for hosting this in my VPS, I cloned the project in my VPS and imported my local database to remote database.

My Wordpress is hosting in remote, but why when I try access admin area with url hwsystem.com.br/wp-admin, this redirecting me to http://localhost/wp-login.php?redirect_to=http%3A%2F%2Fhwsystem.com.br%2Fwp-admin%2F&reauth=1 ?

How can I fix this problem?


I found where the problem is!

This problem is because I import database of my local database, where options_value of options_name in wp_options table is http://localhost, I just change it to my remote domain and is working.

回答1:

When You move your files please login to your database and update the wp_options table site url and home url fields to your actual location.

Then login to the back end and update all permalinks

All done!



回答2:

In your wp_options table in the MySQL DB, change the site url value to the remote site's domain name (i.e., hwsystem.com.br). It's most likely currently set to localhost You can also make this change within the admin interface, but seeing as you cannot access it, you'll need to change this value directly within the database.

Depending on your comfortability with MySQL, you can easily update this value with a SQL command, or use a GUI application such as HeidiSQL.



回答3:

Moving a Wordpress website from localhost to online is not that simple, some times there are a lot of urls you have to change instead of only dealing with wp_options for example images path usually include the full localhost address.

  • The best and simplest way to make this right is by using this plugin: Duplicator
    It will make any needed change it needs to happen, check it out.
  • You can also try to search and remove/replace localhost strings or anything else with this tool also https://github.com/interconnectit/Search-Replace-DB this works too.