admin管理员组

文章数量:1122846

My goal is to have a test.example.de testing environment for my www.example.de WP Blog.

Sadly, the site is still redirecting me to the production-site.

My subdomain is registered as a CNAME with a TTL of 3600 (INVX). I also added it to my domains on my server-hosting dashboard (UBERSPACE).

Here are all of the steps I made:

  1. Copied html directory (whole production-site) to my local disk

  2. Created a new directory called dev.example.de (note that my hosting provider uberspace is handling subdomains like that, so no need for setting up a vhost. I've also tested it with a simple index.html before I continued and it worked well).

  3. Copied the whole site back to the server via SFTP into the new directory

  4. Changed DOMAIN_CURRENT_SITE to my new subdomain URL (test.example.de) inside the wp-config.php file.

  5. Added the following lines inside the wp-config.php file:


    /*  URL for Subdomain */

    define('WP_HOME','http:/\/test.example.de');
    define('WP_SITEURL','http:/\/test.example.de');

  1. Added allow repair:
    a /* Allow repair */
    define('WP\_ALLOW\_REPAIR', true);

  1. Copied the database of my production site in phpMyAdmin and changed the URL in wp_blogs and wp_site to the subdomain URL. The wp_blogs in the production site database looks like that:

domain: www.example.de path: /

The wp_blogs in the testing site database looks like that now:

domain: test.example.de
path: / (I also tried pointing to the directory (/user/test.example.de/), but it didn't work either)
  1. Changed DB_Name to the new database name inside the wp-config.php file.

Note: Before I made changes to the wp_blogs, I wasn't being redirected, but it said: Connection to database failed. The site has also not been updated in a few months. Same for plugins. I wanted to do all that in the testing environment first, to see if there will be issues and to avoid downtime of the blog.

My goal is to have a test.example.de testing environment for my www.example.de WP Blog.

Sadly, the site is still redirecting me to the production-site.

My subdomain is registered as a CNAME with a TTL of 3600 (INVX). I also added it to my domains on my server-hosting dashboard (UBERSPACE).

Here are all of the steps I made:

  1. Copied html directory (whole production-site) to my local disk

  2. Created a new directory called dev.example.de (note that my hosting provider uberspace is handling subdomains like that, so no need for setting up a vhost. I've also tested it with a simple index.html before I continued and it worked well).

  3. Copied the whole site back to the server via SFTP into the new directory

  4. Changed DOMAIN_CURRENT_SITE to my new subdomain URL (test.example.de) inside the wp-config.php file.

  5. Added the following lines inside the wp-config.php file:


    /*  URL for Subdomain */

    define('WP_HOME','http:/\/test.example.de');
    define('WP_SITEURL','http:/\/test.example.de');

  1. Added allow repair:
    a /* Allow repair */
    define('WP\_ALLOW\_REPAIR', true);

  1. Copied the database of my production site in phpMyAdmin and changed the URL in wp_blogs and wp_site to the subdomain URL. The wp_blogs in the production site database looks like that:

domain: www.example.de path: /

The wp_blogs in the testing site database looks like that now:

domain: test.example.de
path: / (I also tried pointing to the directory (/user/test.example.de/), but it didn't work either)
  1. Changed DB_Name to the new database name inside the wp-config.php file.

Note: Before I made changes to the wp_blogs, I wasn't being redirected, but it said: Connection to database failed. The site has also not been updated in a few months. Same for plugins. I wanted to do all that in the testing environment first, to see if there will be issues and to avoid downtime of the blog.

Share Improve this question edited Apr 14, 2024 at 21:54 Erick Holz asked Apr 12, 2024 at 14:40 Erick HolzErick Holz 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I made it work by doing both the "Standart Find & Replace" and "Custom Find & Replace" steps when exporting the database via the Wordpress-Plugin "WP Migrate". Before succeeding, I skipped the "Standart Find & Replace" step, because I thought the custom step would be enough.

Down below you can see both steps with www.example.com as the production site and dev.example.com as for the testing site as an example:

Enjoy!

本文标签: phpDuplicated WP Multisite for testing environment is redirecting to production site