Created
June 19, 2022 20:59
-
-
Save ainsofs/4e5d1d2d706e2357efbef6f05fbfa1a2 to your computer and use it in GitHub Desktop.
Redirect script that can be used in wodby environment
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
# 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