How to create a development environment for WordPress

When renewing a WordPress site, you should be able to work on a copy of the site with a similar development environment without having to put the site into production for maintenance during this time. For that, it is necessary to prepare a preproduction environment in which a duplicate of the site will be made to renew it.

There are many methods to work with WordPress. Within the framework of a site made with CMS, we will give preference to a server development environment that will offer the advantage of working in the same environment as the production site.

  1. Creation of the preproduction environment
    Site Creation
    The first step is to create the site where you are going to copy the current version of your website. Thus, it is necessary to create a new site (for example preprod.your-site.com ) with a directory that belongs to you in your web hosting. To do this, simply follow this guide being careful to create a new directory (for example / preprod ) that is not in the folder of your site currently in production.

creation of the database
After creating the site that hosts the copy of your current site, it is necessary to create the database in which you will duplicate all its content (pages, articles, comments, etc.). If necessary, this guide shows you how to create a new database and a new user for your development environment step by step.

Copy of files and database
Once you have created the site and the database of the preproduction environment, you only have to duplicate the files and content of your site.

To copy the files, we recommend that you use our FTP Manager or do it with SSH to go faster. For the database, you can export and import it through your Manager, or do it with SSH if your database is bulky ( guide ).

WordPress configuration file adaptation
The last step is to adapt the following data from the wp-config.php file of the pre-production site:

the name of the database (DB_NAME)
the database user (DB_USER)
the password of the database user (DB_PASSWORD)
If the production site is with https, it will also be necessary to activate an SSL certificate in the preproduction site ( guide ).

Finally, put the preproduction site into maintenance in order to avoid indexing it by search engines. To do this, you can activate the Infomaniak maintenance mode .

  1. Renewal of the site in the preproduction environment

If you modify the structure of your site and the URLs of your articles / pages change, you can use a free extension such as Redirection to automatically create redirects. This will prevent your visitors from falling into 404 pages when the engines re-index your site or if external sites include links to your site.

  1. Commissioning of the new site
    When you have finished remodeling your site, all you have to do is modify the destination directory of the production site to the production environment directory and modify the URLs of the preproduction site based on the domain name of the production site thanks to an extension like Velvet Blues Update URL or through phpMyAdmin .

If you use a cache extension such as WP-Rocket, W3 Total Cache or WP Super Cache, you must completely clear the entire cache or even deactivate and reactivate the plugin.

After usage checks (are images missing? Are there any wrong links? Etc.), you just have to deactivate the maintenance mode of your site and see the result 🙂

In summary, these are the steps to follow to put your site into production:

change the destination directory of the site su-site.com to / preprod
use the Velvet Blues Update URL plugin to replace the URLs in articles and pages of type preprod.your-site.com with your-site.com
empty or even disable and reactivate your cache plugin
verify the correct functioning of your site
disable maintenance

  1. Recovery of the latest modifications
    If you have continued to modify your site in production during the renewal of the site, you must recover your modifications (articles, multimedia files, pages, etc.).

Infomaniak Cloud Servers and Hosts are optimized for WordPress and offer many advantages for this CMS:

80 free themes (ElegantThemes, editor of the famous Divi theme )
automatic installation of WordPress and the chosen theme
free SSL certificates
unlimited MySQL databases
etc.

Leave a Reply

Your email address will not be published. Required fields are marked *