How to change domain name in wordpress
Whether it is a personal website or a corporate website, generally we do not recommend changing the domain name of the website, because this will not only affect the ranking of the website in search engine results, It reduces website traffic and also leaves a bad impression among website users. However, in some cases, we also have to change domain names. For example, we purchased a more suitable domain name; or we forgot to renew the previous domain name and had to change it to a new domain name; or we used a temporary domain name during the website registration period and switched to our own domain name after registration; or we built a website for a customer and the test was completed Then switch to the official domain name and so on.

Let’s take the demo website at hand as an example to introduce how to change the domain name of the WordPress website from the old domain name www.mydomain.com to the new domain name www.newdomain.com .
The first step, before starting, please back up the website, website database and website files. Especially the database must be backed up to prevent errors during the operation. We can use the backed up database to re-operate.
The second step is to resolve and bind the new domain name. Resolving a new domain name means pointing the domain name to the IP address of the server, usually at the domain name provider; binding the new domain name, usually at the space provider, means adding the new domain name on the server and ensuring that the website directory and the old domain name are The website directory is consistent.
After completing the above two steps, you need to confirm that the new domain name is effective before continuing with the following operations. After the new domain name is set for resolution, it usually takes a while to be transmitted to the local network. The effective time is not consistent in different places. It usually takes a few minutes or a few hours, and it will not exceed 48 hours at most. You can use the ping command to check to see if the new domain name is effective. If the IP address pinged is the IP just set, then the resolution will take effect.
After the new domain name takes effect, you can open the original website by entering the new domain name and the old domain name in the browser at this time. If the old domain name is no longer valid, for example, has expired, or has been resolved to another place, etc., then although the website can be opened, the web page will look messy; this is because the web page cannot load the WordPress theme style sheet normally.
The third step is to log in to the host management system, enter phpmyadmin, and select the database used by the WordPress website. If you are not sure which database WordPress is using, you can check the wp-config.php configuration file in the WordPress directory to see the DB_NAME setting.
After selecting the database, click SQL and enter the following code:
UPDATE wp_options SET option_value = replace(option_value, 'www.mydomain.com','www.newdomain.com') ; UPDATE wp_posts SET post_content = replace(post_content, 'www.mydomain.com','www.newdomain.com') ; UPDATE wp_comments SET comment_content = replace(comment_content, 'www.mydomain.com', 'www.newdomain.com') ; UPDATE wp_comments SET comment_author_url = replace(comment_author_url, 'www.mydomain.com', 'www.newdomain.com') ;
In the above code, www.mydomain.com represents the original domain name, and www.newdomain.com represents the new domain name. The domain name must be entered completely; if you use a second-level domain name like blog.newdomain.com, it is also ok, just enter the complete domain name.

Modify the WordPress website domain name in phpmyadmin
Then click the [Execute] button in the lower right corner, and that’s it. phpmyadmin will return the results and tell you how many places were modified in each line of command. In this way, we have perfectly switched the WordPress domain name to the new domain name.
Compared with modifying the domain name directly in the WordPress management background, the method introduced today has two advantages:
1. Even if the old domain name has expired, you can still change it to a new domain name; because During the entire operation, there is no need to log in to the WordPress management backend.
2. The replacement is relatively complete. Not only the domain name of the website has been changed, but also the links within the article, the addresses and links of media files such as pictures, audio and video, and links in comments, etc. have also been changed.
Therefore, through the above operations, you can perfectly change the WordPress website domain name. Now, try using the new domain name to access your WordPress website. Are there any problems?
For more WordPress technical articles, please visit the WordPress Tutorial column!
The above is the detailed content of How to change domain name in wordpress. For more information, please follow other related articles on the PHP Chinese website!
Top 9 WordPress Themes To Use in 2025Apr 17, 2025 am 08:26 AMIn 2025, choosing the perfect WordPress theme is no longer a priority. The real challenge is choosing a topic that is flexible enough to meet the needs of the current project and adapt to the evolution of future needs. The good news is that you don't have to start from scratch. Whether you are building a website for your customers or expanding your own digital products, the following topics strike the ideal balance between design freedom, technical performance, and long-term reliability. These topics are built by developers who understand the important factors: regular updates, clean code, mobile-first responsive design, and compatibility with tools you already use, such as Elementor, Gutenberg, and WooCommerce. In this review, we have narrowed the scope to 9
How To Begin A WordPress Blog: A Step-By-Step Guide For BeginnersApr 17, 2025 am 08:25 AMBlogs are the ideal platform for people to express their opinions, opinions and opinions online. Many newbies are eager to build their own website but are hesitant to worry about technical barriers or cost issues. However, as the platform continues to evolve to meet the capabilities and needs of beginners, it is now starting to become easier than ever. This article will guide you step by step how to build a WordPress blog, from theme selection to using plugins to improve security and performance, helping you create your own website easily. Choose a blog topic and direction Before purchasing a domain name or registering a host, it is best to identify the topics you plan to cover. Personal websites can revolve around travel, cooking, product reviews, music or any hobby that sparks your interests. Focusing on areas you are truly interested in can encourage continuous writing
Can I learn WordPress in 3 days?Apr 09, 2025 am 12:16 AMCan learn WordPress within three days. 1. Master basic knowledge, such as themes, plug-ins, etc. 2. Understand the core functions, including installation and working principles. 3. Learn basic and advanced usage through examples. 4. Understand debugging techniques and performance optimization suggestions.
Is WordPress a CMS?Apr 08, 2025 am 12:02 AMWordPress is a Content Management System (CMS). It provides content management, user management, themes and plug-in capabilities to support the creation and management of website content. Its working principle includes database management, template systems and plug-in architecture, suitable for a variety of needs from blogs to corporate websites.
What is the WordPress good for?Apr 07, 2025 am 12:06 AMWordPressisgoodforvirtuallyanywebprojectduetoitsversatilityasaCMS.Itexcelsin:1)user-friendliness,allowingeasywebsitesetup;2)flexibilityandcustomizationwithnumerousthemesandplugins;3)SEOoptimization;and4)strongcommunitysupport,thoughusersmustmanageper
Should I use Wix or WordPress?Apr 06, 2025 am 12:11 AMWix is suitable for users who have no programming experience, and WordPress is suitable for users who want more control and expansion capabilities. 1) Wix provides drag-and-drop editors and rich templates, making it easy to quickly build a website. 2) As an open source CMS, WordPress has a huge community and plug-in ecosystem, supporting in-depth customization and expansion.
How much does WordPress cost?Apr 05, 2025 am 12:13 AMWordPress itself is free, but it costs extra to use: 1. WordPress.com offers a package ranging from free to paid, with prices ranging from a few dollars per month to dozens of dollars; 2. WordPress.org requires purchasing a domain name (10-20 US dollars per year) and hosting services (5-50 US dollars per month); 3. Most plug-ins and themes are free, and the paid price ranges from tens to hundreds of dollars; by choosing the right hosting service, using plug-ins and themes reasonably, and regularly maintaining and optimizing, the cost of WordPress can be effectively controlled and optimized.
Is WordPress still free?Apr 04, 2025 am 12:06 AMThe core version of WordPress is free, but other fees may be incurred during use. 1. Domain names and hosting services require payment. 2. Advanced themes and plug-ins may be charged. 3. Professional services and advanced features may be charged.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version
Useful JavaScript development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Zend Studio 13.0.1
Powerful PHP integrated development environment






