Wordpress Settings

Below you will find instructions on configuring your WordPress project to work with Docksal.

DB Connection Settings

Update the DB settings in wp-config.php as follows:

define( 'DB_NAME', getenv('MYSQL_DATABASE') );
define( 'DB_USER', getenv('MYSQL_USER') );
define( 'DB_PASSWORD', getenv('MYSQL_PASSWORD') );
define( 'DB_HOST', getenv('MYSQL_HOST') );

Using HTTPS

Docksal uses a reverse proxy, which terminates HTTPS connections and passes the connection on to projects in plain HTTP. In such setups, WordPress does not know out of the box when it’s loaded over HTTPS.

To help WordPress detect when it’s loaded over HTTPS, add the following lines at the top of your wp-config.php:

// Pass "https" protocol from reverse proxies
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
  $_SERVER['HTTPS'] = 'on';
}

Then, change the site URL protocol either via admin UI under Settings > General, or via wp-config.php:

// Set site URL (or update this in Settings/General in admin UI)
define( 'WP_HOME', 'https://wordpress.docksal.site/' );
define( 'WP_SITEURL', 'https://wordpress.docksal.site/' );

Multisite Settings

When converting a single site to a multi-site, there can be some issues that occur with redirect loops. Make sure to update the .htaccess instructions found on the WordPress.org site. Htaccess settings for WordPress multisite.