홈페이지 도메인을 변경했는데요...
본문
aaa.com 도메인을 aaa.kr로 변경하려고하는데요....
aaa.com에 index.html안에
<html>
<head>
<title>페이지 이동</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript">
function forwarding()
{location = "http://aaa.kr"}
</script>
</head>
<body onLoad="setTimeout('forwarding()', 100)">
</body>
</html>
이렇게 만들어서 aaa.com으로 들어오는 사람들을 aaa.kr 로 들어오게 했는데요...
aaa.com/1
aaa.com/2
등 aaa.com 주소뒤에 모가 붙으면 aaa.kr로 이동하지 않는데 aaa.com/1 과 같이 뒤에 주소가 붙어도 무조건 aaa.kr로 들어오게 하고 싶은데
어떡해해야하는지 알려주시면 감사하겠습니다....
답변 1
PHP
if ($_SERVER['SERVER_NAME'] !== 'aaa.kr') {
// header('Location: http://aaa.kr');
header('Location: http://aaa.kr' . $_SERVER['REQUEST_URI']);
}
JavaScript
if (document.domain != 'aaa.kr') {
// location.replace('http://aaa.kr');
location.replace('http://aaa.kr' + location.pathname + location.search);
}
답변을 작성하시기 전에 로그인 해주세요.