CloudFlare 로 URL 주소 자동 포워딩 하는 방법
    - 클라우드플레어 에서 auto URL Redirect 설정
//-------------------------------------
    - 상황 
host1.example.com 주소를 example.com으로 자동 주소 변경하려는 상황
//-------------------------------------
    - 설정
https://dash.cloudflare.com/ 
        도메인 선택
//-------------------------------------
    -> DNS  -> 레코드 추가 
형식 : CNAME 
이름 : host1 
대상 : example.com
        -> 저장
//-------------------------------------
    -> 규칙 -> Page Rules -> Page Rule 생성 
        - 3개까지 무료, 초과 사용은 유료 : 월 $5 
URL : host1.example.com/* 
설정 선택 : 전달 URL , 상태 코드 선택 : 301 - 영구 리디렉션 
대상 URL 입력 : https://example.com/$1 
    -> Page Rule 저장및 배포 선택 
//-----------------------------------------------------------------------------
// 참고 
https://support.cloudflare.com/hc/en-us/articles/4729826525965-Configuring-URL-forwarding-or-redirects-with-Page-Rules 
//-----------------------------------------------------------------------------
// 참고만
// 오라클 무료 웹서버 사용시 index.php 소스 코드
<?php
function getUrl()
{
    $s = $_SERVER;
    $use_forwarded_host = true;
    $ssl = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on');
    $sp = strtolower($s['SERVER_PROTOCOL']);
    $protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : '');
    $port = $s['SERVER_PORT'];
    $port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':' . $port;
    $host = ($use_forwarded_host && isset($s['HTTP_X_FORWARDED_HOST'])) ? $s['HTTP_X_FORWARDED_HOST'] : (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : null);
    $host = isset($host) ? $host : $s['SERVER_NAME'] . $port;
    return $protocol . '://' . $host . $s['REQUEST_URI'];
}
$url = getUrl();
$path = parse_url($url, PHP_URL_PATH);
$query = parse_url($url, PHP_URL_QUERY);
$blog = 'https://example.com'; 
$redir = sprintf('%s%s%s', $blog, $path, $query ? "?$query" : '');
header("Location: $redir"); //빈칸 중요