Last active
September 30, 2022 19:53
-
-
Save ryansechrest/8430868 to your computer and use it in GitHub Desktop.
Sample configuration files for WordPress as Git submodule.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
# Prevent requests to index.php from being rewritten | |
RewriteRule ^index\.php$ - [L] | |
# Prefix specified PHP files with 'wordpress' | |
RewriteRule ^((wp-login|xmlrpc)\.php) wordpress/$1 [R=301,L] | |
# Prefix wp-admin and wp-includes with 'wordpress' | |
RewriteRule ^(wp-(admin|includes).*) wordpress/$1 [L] | |
# Resolve uploaded files | |
RewriteRule ^files/(.+) wordpress/wp-includes/ms-files.php?file=$1 [L] | |
# Route non-files and non-directories to root's index.php | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . index.php [L] | |
</IfModule> | |
# END WordPress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Enable/disable WordPress themes */ | |
define('WP_USE_THEMES', true); | |
/** Load WordPress environment and template */ | |
require './wordpress/wp-blog-header.php'; | |
// EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Set constants based on environment | |
* | |
* DB_NAME Database name | |
* DB_USER Database username | |
* DB_PASSWORD Database password | |
* DB_HOST Database hostname | |
* FORCE_SSL_ADMIN Enable/disable SSL on login and in admin | |
* WP_DEBUG Enable/disable WordPress debugging | |
*/ | |
$environment = ''; | |
if (isset($_SERVER['APP_ENVIRONMENT'])) { | |
$environment = $_SERVER['APP_ENVIRONMENT']; | |
} | |
switch ($environment) { | |
case 'LOCALHOST': | |
define('DB_NAME', ''); | |
define('DB_USER', ''); | |
define('DB_PASSWORD', ''); | |
define('DB_HOST', 'localhost'); | |
define('FORCE_SSL_ADMIN', true); | |
define('WP_DEBUG', true); | |
break; | |
case 'DEVELOPMENT': | |
define('DB_NAME', ''); | |
define('DB_USER', ''); | |
define('DB_PASSWORD', ''); | |
define('DB_HOST', 'localhost'); | |
define('FORCE_SSL_ADMIN', true); | |
define('WP_DEBUG', true); | |
break; | |
case 'STAGING': | |
define('DB_NAME', ''); | |
define('DB_USER', ''); | |
define('DB_PASSWORD', ''); | |
define('DB_HOST', 'localhost'); | |
define('FORCE_SSL_ADMIN', true); | |
define('WP_DEBUG', false); | |
break; | |
default: | |
define('DB_NAME', ''); | |
define('DB_USER', ''); | |
define('DB_PASSWORD', ''); | |
define('DB_HOST', 'localhost'); | |
define('FORCE_SSL_ADMIN', true); | |
define('WP_DEBUG', false); | |
break; | |
} | |
/** | |
* Database settings | |
*/ | |
/** Database character set */ | |
define('DB_CHARSET', 'utf8'); | |
/** Database collation */ | |
define('DB_COLLATE', ''); | |
/** Database table prefix */ | |
$table_prefix = 'wp_'; | |
/** | |
* WordPress settings | |
*/ | |
/** WordPress.com API key */ | |
define('WPCOM_API_KEY', ''); | |
/** URL to WordPress site */ | |
//define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']); | |
/** URL to WordPress installation */ | |
//define('WP_SITEURL', WP_HOME . '/wordpress'); | |
/** Absolute path to wp-content directory */ | |
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content'); | |
/** URL to wp-content directory */ | |
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp-content'); | |
/** Slug of default WordPress theme */ | |
//define('WP_DEFAULT_THEME', 'twentyfourteen'); | |
/** Number of seconds between autosaves */ | |
define('AUTOSAVE_INTERVAL', 300); | |
/** Number of days before trash is emptied */ | |
define('EMPTY_TRASH_DAYS', 30); | |
/** Maximum number of post revisions to keep */ | |
define('WP_POST_REVISIONS', 5); | |
/** Enable/disable plugin and theme editor */ | |
define('DISALLOW_FILE_EDIT', true); | |
/** Enable/disable plugin and theme installation/update */ | |
define('DISALLOW_FILE_MODS', true); | |
/** Enable/disable WordPress cron */ | |
define('DISABLE_WP_CRON', true); | |
/** Enable/disable WordPress auto-update */ | |
define('WP_AUTO_UPDATE_CORE', false); | |
/** WordPress language */ | |
define('WPLANG', ''); | |
/** Enable/disable WordPress multisite functionality */ | |
define('WP_ALLOW_MULTISITE', true); | |
/** | |
* Multisite settings (AFTER it has been enabled) | |
*/ | |
/** Enable/disable WordPress multisite */ | |
define('MULTISITE', true); | |
if (defined('MULTISITE') && MULTISITE) { | |
/** Configure multisite with subdomains (true) or subdirectories (false) */ | |
define('SUBDOMAIN_INSTALL', true); | |
/** Domain name of default WordPress website */ | |
define('DOMAIN_CURRENT_SITE', $_SERVER['SERVER_NAME']); | |
/** Path to default WordPress website */ | |
define('PATH_CURRENT_SITE', '/'); | |
/** Site ID of default multisite network */ | |
define('SITE_ID_CURRENT_SITE', 1); | |
/** Blog ID of default WordPress website */ | |
define('BLOG_ID_CURRENT_SITE', 1); | |
/** Domain name of where to direct non-existant websites */ | |
define('NOBLOGREDIRECT', 'http://' . $_SERVER['SERVER_NAME']); | |
} | |
/** | |
* Debugging settings | |
*/ | |
if (defined('WP_DEBUG') && WP_DEBUG) { | |
/** Enable/disable writing error to debug.log in wp-content directory */ | |
define('WP_DEBUG_LOG', true); | |
/** Enable/disable displaying error messages */ | |
define('WP_DEBUG_DISPLAY', true); | |
/** Enable/disable minification of styles and scripts */ | |
define('SCRIPT_DEBUG', true); | |
/** Enable/disable saving database queries */ | |
define('SAVEQUERIES', true); | |
/** Enable/disable concatentation of script files */ | |
define('CONCATENATE_SCRIPTS', false); | |
} | |
/** | |
* W3 Total Cache | |
*/ | |
/** Enable/disable W3 Total Cache */ | |
define('WP_CACHE', true); | |
/** | |
* WordPress keys and salts | |
* https://api.wordpress.org/secret-key/1.1/salt/ | |
*/ | |
define( | |
'AUTH_KEY', | |
'' | |
); | |
define( | |
'SECURE_AUTH_KEY', | |
'' | |
); | |
define( | |
'LOGGED_IN_KEY', | |
'' | |
); | |
define( | |
'NONCE_KEY', | |
'' | |
); | |
define( | |
'AUTH_SALT', | |
'' | |
); | |
define( | |
'SECURE_AUTH_SALT', | |
'' | |
); | |
define( | |
'LOGGED_IN_SALT', | |
'' | |
); | |
define( | |
'NONCE_SALT', | |
'' | |
); | |
/** | |
* Misc. WordPress configuration | |
*/ | |
/** Absolute path to WordPress directory */ | |
if (!defined('ABSPATH')) { | |
define('ABSPATH', dirname(__FILE__) . '/'); | |
} | |
/** Setup WordPress vars and include files */ | |
require_once ABSPATH . 'wp-settings.php'; | |
// EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I really, really like this, but I am having a heckuva time figuring out how I can get multisite working as subdomains here... Is there anything I am missing? I keep getting redirect loops when I setup my child sites (I'm trying to use folders instead of subdomains, fwiw), though I would be happy to have my main site as www.mysite.ca and my child site at childsite.mysite.ca, but I can't seem to figure out how to have my main site at www. and my childsite not at childsite.www.