프로그래밍/PHP

php 다른 도메인으로 리다이렉트

◎◇ 2024. 6. 1. 21:57

<?php
$full_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
 
//https 도메인 redirect 하기
if (strpos($full_url, "test.com") !== false) {
// header("Location: https://www.aaaaa.com".$_SERVER['REQUEST_URI']); exit;
}
?>