Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update wp-config.php #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions wp-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,48 @@
*/
define('WPLANG', '');

if (isset($_ENV['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') {
// Redirect to https://$primary_domain in the Live environment
if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live') {
if (isset($_ENV['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') {
// Redirect to https://$primary_domain in the Live environment
if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live') {
// Replace www.example.com with your registered domain name.
$primary_domain = 'blog.flexshopper.com';
}
else {
// Redirect to HTTPS on every Pantheon environment.
$primary_domain = $_SERVER['HTTP_HOST'];
}

if ($_SERVER['HTTP_HOST'] != $primary_domain
|| !isset($_SERVER['HTTP_USER_AGENT_HTTPS'])
|| $_SERVER['HTTP_USER_AGENT_HTTPS'] != 'ON' ) {

// Name transaction "redirect" in New Relic for improved reporting (optional).
if (extension_loaded('newrelic')) {
newrelic_name_transaction("redirect");
}

header('HTTP/1.0 301 Moved Permanently');
header('Location: https://'. $primary_domain . $_SERVER['REQUEST_URI']);
exit();
}
}
// Redirect subdomain to a specific path.
// Check if Drupal or WordPress is running via command line
if (isset($_ENV['PANTHEON_ENVIRONMENT']) === 'live') && ($_SERVER['HTTP_HOST'] == 'blog.flexshopper.com') && (php_sapi_name() != "cli")) {
$newurl = 'https://www.flexshopper.com/blog/'. $_SERVER['REQUEST_URI'];
header('HTTP/1.0 301 Moved Permanently');
header("Location: $newurl");

// Name transaction "redirect" in New Relic for improved reporting (optional).
if (extension_loaded('newrelic')) {
newrelic_name_transaction("redirect");
}

exit();
}
/**
* For developers: WordPress debugging mode.
*
Expand All @@ -140,3 +182,4 @@

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');