问题
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="http://amac-china.com.cn/cft/xmlrpc.php">
<title>彩辉纺织 – 一流管理、一流技术、一流服务,造一流的品质</title>
<link rel="dns-prefetch" href="//amac-china.com.cn">
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//s.w.org">
<link rel="alternate" type="application/rss+xml" title="彩辉纺织 » Feed" href="http://amac-china.com.cn/cft/feed/">
<link rel="alternate" type="application/rss+xml" title="彩辉纺织 » 评论Feed" href="http://amac-china.com.cn/cft/comments/feed/">
</script><script src="http://amac-china.com.cn/cft/wp-includes/js/wp-emoji-release.min.js?ver=4.9.14" type="text/javascript" defer=""></script>
</style>
<link rel="stylesheet" id="sydney-font-awesome-css" href="http://amac-china.com.cn/cft/wp-content/themes/sydney/fonts/font-awesome.min.css?ver=4.9.14" type="text/css" media="all">
<!--[if lte IE 9]>
<link rel='stylesheet' id='sydney-ie9-css' href='http://amac-china.com.cn/cft/wp-content/themes/sydney/css/ie9.css?ver=4.9.14' type='text/css' media='all' />
<![endif]-->
<script type="text/javascript" src="http://amac-china.com.cn/cft/wp-includes/js/jquery/jquery.js?ver=1.12.4"></script></head>
how to replace "amac-china.com.cn" with "leavenotrace.cn"? where is setting in wordpress?
回答1:
A lot can go wrong when you’re trying to change a fundamental setting like the domain. If you are not moving the files, I think the easiest way for you might be to create a new database with the new domain and then change the existing website to use this simply by updating the database settings in wp-config.php
Then use a plugin to do the hard work of correctly updating all references to the old domain. There might be another plugin to do this but I’m most familiar with the Duplicator plugin.
- Install the plugin on the existing website and build a new package but make sure you choose the “database only” option!
- Download this ZIP file and installer.php to your hosting
- Create a new empty database
- Run the installer wizard, enter your new database details and make sure the URL in the new settings is your new domain.
Now you just need to update the database details in wp-config.php so your website will use the new database.
This will update the database and system settings which should be everything. Just in case there are hardcoded references to the old domain, do a text search on your files. In particular, check your .htaccess
for any hardcoded redirects.
There are ways of updating the URLs directly in the existing database, but I prefer this option because it sets up the new database without affecting the existing one - so if anything goes wrong, you can switch back easily and try again.
回答2:
another way, execute SQL in Database:
UPDATE wp_options SET option_value = replace(option_value, 'http://old.com', 'http://new.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://old.com','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old.com', 'http://new.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://old.com','http://new.com');
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'http://old.com', 'http://new.com');
UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'http://old.com', 'http://new.com');
UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'http://old.com','http://new.com');
回答3:
Export the .sql file, then use your favorite code editor to open the exported .sql file and search for and replace the old domain name with the new domain name. Then directly delete all data tables in the site database, and then import it into the database.
来源:https://stackoverflow.com/questions/62717290/how-to-replace-domain-name-in-an-existing-wordpress-site