คือผม จะทำโดเมน สอง โดเมนในเว็บเดียวอะครับ
แต่ติดปัญหา ตรงที่ว่า ผมต้องการให้ domainB.com ชี้ไปอีกไฟล์ ที่ไม่ใช้ไฟล์ index อะครับ
ใครพอเขียน .htaccess เป็นบ้างครับ
ขอบคุณครับ
อ่อ อย่าลืมนึกถึง ตอนเรียกใช้ พวก รูปภาพ และ css ด้วยนะครับ
คือผม จะทำโดเมน สอง โดเมนในเว็บเดียวอะครับ
แต่ติดปัญหา ตรงที่ว่า ผมต้องการให้ domainB.com ชี้ไปอีกไฟล์ ที่ไม่ใช้ไฟล์ index อะครับ
ใครพอเขียน .htaccess เป็นบ้างครับ
ขอบคุณครับ
อ่อ อย่าลืมนึกถึง ตอนเรียกใช้ พวก รูปภาพ และ css ด้วยนะครับ
ผมใช้วิธีเช็คในไฟล์ index.php เลยครับ
<?php
$reqhostname = getenv("HTTP_HOST");
if (eregi('domainA.com', $reqhostname)) {
header("location:http://www.DomainA.com/aaa.php");
exit();
}
if (eregi('domainB.com', $reqhostname)) {
header("location:http://www.domainB.com/bbb/index.php");
exit();
}
if (eregi('domainC.com', $reqhostname)) {
header("location:http://www.domainC.com/index.php?op=ccc");
exit();
}
//Call from Default domain.com
include "home.php";
?>
ถ้าเราไม่ต้องการให้ เปลี่ยนลิงค์ สามารถทำได้ไหมคับ
<?php
$reqhostname = getenv("HTTP_HOST");
if (eregi('domainB.com', $reqhostname)) {
include "domainB.php";
} else {
//Call from Default domainA.com
include "domainA.php";
}
?>
ขอบคุณครับ
function eregi กำลังจะถูกยกเลิกนะครับ ถ้า check แค่นี้ใช้ strpos ดีกว่ามั้ง