Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wildcard redirect to primary host from alias domains
<?php
add_filter( 'init', function () {
if ( empty( $_SERVER['HTTP_AKAMAI_ORIGIN_HOP'] ) && empty( $_SERVER['HTTP_X_DSA_HOST'] ) && ! empty( $_SERVER['SERVER_NAME'] ) && 'origin-garage.godaddy.net' === $_SERVER['SERVER_NAME'] ) {
$path = ! empty( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '/garage';
wp_safe_redirect( 'https://www.godaddy.com' . $path, 301 );
exit;
}
}, 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment