Skip to content

2. Deploying

Alex Prokopenko edited this page Sep 18, 2018 · 4 revisions

For existing projects run on WordPress Starter deployment process has a few tricks.

We assume that you're using GIT repository, because it's a right way to keep your code safe!

Deploy process

Clone repository

cd /path/to/your/project/empty/folder/
git clone http://git-storage-domain.com/your/project.git ./

Run composer

composer install

This will download WordPress core files and public plugins.

Configure the environment

Update your .env file with Database credentials, your host and environment (development, 'staging, production).

  • DB_NAME - Database name
  • DB_USER - Database user
  • DB_PASSWORD - Database password
  • DB_HOST - Database host
  • WP_ENV - Set to environment (development, staging, production)
  • WP_HOME - Full URL to WordPress home (http://example.com)

Update your .htaccess file with new subfolder if you moved site into another subfolder.

  • Update RewriteBase
  • Update RewriteRule, which redirects wp-admin to cms/wp-admin
  • Update main RewriteRule with index.php

Install database

Import database dump with your favorite database software.

Upgrade your site URLs

WordPress stores a lot URLs inside the database, so after migrating a site to a different domain/folder you have to upgrade you database. Furthermore, WordPress serialize a lot data inside, so you can't do this with simple MySQL query.

Fortunately, we have a lot of tools which can help us with that:

Switch to the latest code

We recommend to follow Gitflow Workflow.

According to Gitflow:

  • master - is a stable production copy
  • develop - is a current development copy

To switch branch just use GIT:

git checkout <branch-name>

Regenarate WP Rewrite Rules

To regenerate WP rewrite rules just open Dashboard -> Settings -> Permalinks and press Save button.


Next: Folder Structure