将wordpress从域迁移到另一个域 - 但URL仍会重定向到旧域

时间:2022-08-23 10:37:30

I have moved one of my website to a new domain, after i have uploaded everything in place homepage is working fine. But all the links and images are still coming from old domain. below is what i did.

我已将我的一个网站移动到一个新域名,在我上传所有内容后,主页工作正常。但所有链接和图像仍然来自旧域。以下是我的所作所为。

  • Backed up database
  • 备份数据库

  • Uploaded all the files to the new server.
  • 将所有文件上载到新服务器。

  • Imported sql into new server via phpmyadmin
  • 通过phpmyadmin将sql导入新服务器

  • Now i have used this script to change URL in database.
  • 现在我使用这个脚本来更改数据库中的URL。

Now, problems i am facing are:

现在,我面临的问题是:

  • All the links are going to old domain.
  • 所有链接都将转到旧域。

  • All the images are linked to old domain.
  • 所有图像都链接到旧域。

  • wp-admin is also redirected to old domain when i try to run mydomain.com/wp-admin
  • 当我尝试运行mydomain.com/wp-admin时,wp-admin也会重定向到旧域

Please help if you have any ideas about this, any help would be greatly appreciated.

如果您有任何想法,请帮忙,任何帮助将不胜感激。

3 个解决方案

#1


My issue is resolved, i am posting this as an answer so that someone else can benefit out of it.

我的问题已经解决,我将此作为答案发布,以便其他人可以从中受益。

My issue was, siteurl and homeurl were not updated, so i have placed define('RELOCATE',true); in my wp-config.php file. And again tried to access the website , it gone to the correct url but all the css was gone. Then i headed over to wp-admin and it also came with no css but still i tried to login but this time it has taken me to the correct url and with css login page but didn't logged in. Then Again i have attempted to login and this time i have logged in successfully. Then i have changed both the urls from settings in the admin panel.

我的问题是,siteurl和homeurl没有更新,所以我放置了define('RELOCATE',true);在我的wp-config.php文件中。并再次尝试访问该网站,它转到正确的网址,但所有的CSS已经消失。然后我前往wp-admin,它也没有css,但我仍然尝试登录,但这次它带我到正确的URL和css登录页面,但没有登录。然后再次我试图登录,这次我已成功登录。然后我从管理面板中的设置更改了两个网址。

Hope this helps someone else dealing with the same problem.

希望这有助于其他人处理同样的问题。

#2


Did you change your urls in wp-config.php?

你在wp-config.php中更改了网址吗?

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

https://codex.wordpress.org/Changing_The_Site_URL

Edit:

Use phpMyAdmin and verify the fields siteurl and home in your wp_options table. These two fields should contain your correct domain.

使用phpMyAdmin并验证wp_options表中的siteurl和home字段。这两个字段应包含正确的域。

#3


Actually, You should use duplicator plugin for this task, It will make our work so easy and handle all the issues itself. I also have this issue now I have made this through duplicator plugin of WordPress it works for me perfectly.

实际上,你应该使用duplicator插件来完成这项任务,这将使我们的工作变得如此简单,并处理所有问题本身。我现在也有这个问题我已经通过WordPress的复制器插件实现了这一点,它对我来说非常有用。

#1


My issue is resolved, i am posting this as an answer so that someone else can benefit out of it.

我的问题已经解决,我将此作为答案发布,以便其他人可以从中受益。

My issue was, siteurl and homeurl were not updated, so i have placed define('RELOCATE',true); in my wp-config.php file. And again tried to access the website , it gone to the correct url but all the css was gone. Then i headed over to wp-admin and it also came with no css but still i tried to login but this time it has taken me to the correct url and with css login page but didn't logged in. Then Again i have attempted to login and this time i have logged in successfully. Then i have changed both the urls from settings in the admin panel.

我的问题是,siteurl和homeurl没有更新,所以我放置了define('RELOCATE',true);在我的wp-config.php文件中。并再次尝试访问该网站,它转到正确的网址,但所有的CSS已经消失。然后我前往wp-admin,它也没有css,但我仍然尝试登录,但这次它带我到正确的URL和css登录页面,但没有登录。然后再次我试图登录,这次我已成功登录。然后我从管理面板中的设置更改了两个网址。

Hope this helps someone else dealing with the same problem.

希望这有助于其他人处理同样的问题。

#2


Did you change your urls in wp-config.php?

你在wp-config.php中更改了网址吗?

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

https://codex.wordpress.org/Changing_The_Site_URL

Edit:

Use phpMyAdmin and verify the fields siteurl and home in your wp_options table. These two fields should contain your correct domain.

使用phpMyAdmin并验证wp_options表中的siteurl和home字段。这两个字段应包含正确的域。

#3


Actually, You should use duplicator plugin for this task, It will make our work so easy and handle all the issues itself. I also have this issue now I have made this through duplicator plugin of WordPress it works for me perfectly.

实际上,你应该使用duplicator插件来完成这项任务,这将使我们的工作变得如此简单,并处理所有问题本身。我现在也有这个问题我已经通过WordPress的复制器插件实现了这一点,它对我来说非常有用。