Simple eight steps to change a domain name for a Wordpress blog on the same host (2)

Source: Internet
Author: User
Tags cpanel wordpress blog

The domain name of jingbo has been changed from essentialblog.cn to jingpin.org. The following describes how to change the domain name.

I. Operations on cpanel:

You can perform the following four steps on the cpanel of the Host:

Step 1: add additional domain names

Find the "Additional domain" option on the cpanel control panel and add your new domain name.

Step 2: Add a database

Generate a new database in the MySQL database.

Step 3: copy an object

To copy all WordPress files corresponding to the original domain name to the space of the new domain name, click "File Manager", select all WordPress files and folders corresponding to the original domain name, and click "copy ", enter the folder path corresponding to the new domain name and click "copy file (s )".

Step 4: Modify the wp-config.php File

Open the WordPress wp-config.php file corresponding to the new domain name through File Manager, change the old database to the new database, if the new database user name and password are different from the old database, you also need to modify.

2. phpMyAdmin operations

This is actually done on cpanel. to emphasize this, let's talk about it here.

Step 5: copy the database

On cpanel, click phpMyAdmin (the Chinese version of cpanel is translated into "phpmy management"), select the database of the original domain name, click "operation", and copy the database: in the "column, enter the new database name (full name, for example, young_jingpin), cancel the check box before" create database before copying ", and click" execute ".

Step 6: Modify the database

 

In phpMyAdmin, select the new database, click "SQL", and enter the followingCode:

  1. Update wp_options set option_value = replace ( option_value, 'HTTP: // www.essentialblog.cn ', 'HTTP: // jingpin.org' ) where option_name = 'home' or option_name = 'siteurl' ;
  2. Update wp_posts set post_content = replace ( post_content, 'HTTP: // www.essentialblog.cn ', 'HTTP: // jingpin.org' ) ;
  3. Update wp_posts set guid = replace ( guid, 'HTTP: // www.essentialblog.cn ', 'HTTP: // jingpin.org' ) ;

During the operation, change www.essentialblog.cn to your old domain name, and change jingpin.org to your new domain name.

After completing this step, you will see the Wordpress blog that is exactly the same as the original domain name when accessing the new domain name. However, after I completed the process, I found that all the pages except the home page could not be accessed. Later, under the guidance of hogogo, I took the following steps:

Step 7: Save the fixed link

Open the "Fixed Link" in the "Settings" option in the WordPress management background, and click "Save changes. This step is boring, but it cannot be less.

The above seven steps have actually completed one thing, that is, copying an identical Wordpress blog. After ensuring that all links to the new blog are normal, you need to redirect the old domain name to the blog of the new domain name so that when others access your old domain name, they will go to your new domain name blog, the procedure is as follows:

Step 8: 301 permanent redirection

Add the following code to the. htaccess file of the original Domain Name:

  1. Rewriteengine on
  2. Rewritecond %{Http_host}^ Www.essentialblog.cn
  3. Rewriterule(.*)HTTP:// Jingpin.org/1_1 [R = 301, l]

If you didn't. the htaccess file can copy and paste the above Code to the notepad, and "htaccess" is saved as the file name, and then uploaded to the root directory of the WordPress folder corresponding to the original domain name.

By the way, the ". htaccess" file corresponding to the original essentialblog.cn contains the following code:

  1. # Begin WordPress
  2. <Ifmodule mod_rewrite.c>
  3. Rewriteengine on
  4. Rewritebase/
  5. Rewritecond %{Request_filename}! -F
  6. Rewritecond %{Request_filename}! -D
  7. Rewriterule./index. php[L]
  8. </Ifmodule>
  9. # End WordPress

If you do not delete this code, you can jump to jingpin.org normally, but not to jingpin.org/aboutafter deleting the code. The. htaccess file on also has the following code:

  1. Rewritecond %{Http_host}^ Essentialblog.cn
  2. Rewriterule(.*)HTTP:// Www.essentialblog.cn/#1 [R = 301, l]

This code directs essentialblog.cn to www.essentialblog.cn, so that if someone accesses essentialblog.cn/about, they will also see jingpin.org/about instead of the 404 error page.

At this point, the entire domain name is replaced, and you can write a blog directly on the WordPress corresponding to the new domain name.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.