ถามเกี่ยวกับการ redirect url ใน .htaccess

เริ่มโดย nuningplus, 10 ธันวาคม 2012, 16:10:34

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

nuningplus

ถ้าเข้ามาโดเมนนี้ domainname.com/abc
ให้ redirect ไปที่ www.domainname.com/abc

ต้องเขียนโค้ดอย่างไรครับ

รบกวนชี้แนะด้วยครับ

sinomoney

.htaccess ไม่เคยทำ  แต่ผมทำแบบนี้ครับ
สร้างไฟล์ index.html  ขึ้นมา แล้วอัฟไปไว้ที่ domainname.com/abc
ต้องการให้ redirect ไปที่โดเมนใหน ก็ใส่ไปที่ newdomain.com ได้เลยครับ

<html>
<head>
<meta http-equiv="Content-Language" content="th">
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=newdomain.com">
</head>
</html>
[direct=http://www.thaiseoboard.com/index.php/topic,438918.0.html]โปรแกรมโพสเว็บบอร์ด[/direct] ระบบโพสบน Server ไม่ต้องติดตั้ง ทดลองฟรี
[direct=https://backlink-seo.com]โปรแกรมทำ Backlink[/direct] CommentBlog ใช้งานบนเว็บ ทดลองฟรี

theballkyo

#2
ลองดูครับ
RewriteEngine On
Options +FollowSymLinks
# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.(.*)
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]


http://forums.b2evolution.net/topic-18121
[direct=https://mc-sv1.enjoyprice.in.th]เล่นฟรี เซิฟเวอร์ Minecraft 1.8.8[/direct]
[direct=https://blog.ezdev.me]blog.ezdev.me เขียนโปรแกรมไม่ใช้เรื่องยาก[/direct]
รับทำเว็บไซต์ PHP ราคากันเองติดต่อได้ที่ theballkyo[at]gmail.com