WordPress, XAMPP, and Windows – a how-to

A Virtual Host Configuration

<VirtualHost [local domain]:[port]>
    DocumentRoot "[filesystem location]"
    ServerName [local domain]
    <Directory "[filesystem location]">
        Require all granted
    </Directory>
</VirtualHost>

hosts file contents

127.0.0.1 [local domain]

WordPress Configuration

if (file_exists(dirname(__FILE__) . '/wp-config-local.php')) {
    // load local database settings
    include(dirname(__FILE__) . '/wp-config-local.php');

    // local site settings
    define('WP_DEBUG', true);
    define('SAVEQUERIES', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', true);

    define('WP_SITEURL', [local domain]);
    define('WP_HOME', [local domain]);
} else {
    // live site settings
    define('DB_NAME', '');
    define('DB_USER', '');
    define('DB_PASSWORD', '');
    define('DB_HOST', '');

    define('DISALLOW_FILE_EDIT', true);
    define('FORCE_SSL_ADMIN', true);

    define('WP_DEBUG', false);
    define('SAVEQUERIES', false);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);

    define('WP_SITEURL', [live domain]);
    define('WP_HOME', [live domain]);
}

Plugins

Related Posts

  • A web-based tool for generating various functionalities that WordPress supports, without needing to remember how…

  • The WPBeginner site has unveiled a new resource for WordPressers: a glossary. WordPress resources are…

  • A suite of test data for WordPress, to be used for testing theme appearance and…