Skip to content

Instantly share code, notes, and snippets.

@ainsofs
Created June 19, 2022 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ainsofs/4e5d1d2d706e2357efbef6f05fbfa1a2 to your computer and use it in GitHub Desktop.
Save ainsofs/4e5d1d2d706e2357efbef6f05fbfa1a2 to your computer and use it in GitHub Desktop.
Redirect script that can be used in wodby environment
# redirect from multiple domains to your primary domain
if (isset($_SERVER['WODBY_ENVIRONMENT_TYPE']) && $_SERVER['WODBY_ENVIRONMENT_TYPE'] == 'prod' && php_sapi_name() != "cli") {
$redirect_from = array(
'oldsite.com',
'alternative-spelling.com',
);
if (in_array($_SERVER['HTTP_HOST'], $redirect_from)) {
header('HTTP/1.0 301 Moved Permanently');
header('Location: https://primary-domain.com');
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment