���� ���ö����ͧ

Redirect to www (.htaccess)

กรณีที่ Pagerank ไม่เท่ากันสามารถทำได้ด้วยการเคลื่อนย้าย gootum.com และ http://www.gootum.com/ กับชื่อโดเมนตามความเป็นจริงของคุณด้วยการสร้างไฟล์ .htaccess วิธีของ redirection ทำงานบนเครื่อง server ที่เป็น linux เท่านั้นวิธีเขียนดังนี้

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

ตัวอย่างที่ไม่อยากทำไฟล์ redirect ครับสามารถทำเปงไฟล์ .htaccess ได้

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^gootum.com [nc]
rewritecond %{http_host} ^www.gootum.com [nc]
rewriterule ^(.*)$ http://blog.gootum.com/$1 [r=301,nc]
rewriterule ^(.*)$ http://blog.gootum.com/$1 [r=301,nc]

แล้วทำการเชฟชื่อไฟล์เป็น .htaccess จบข่าว
301 Redirect

Bookmark and Share

Related Posts

You can leave a response, or trackback from your own site.

3 Responses to “Redirect to www (.htaccess)”

  1. [...] with mod_rewrite in apache htaccess Social Bookmark Blog : These icons link to social bookmarking sites where readers can [...]

  2. ดารา says:

    กว่าจะหาวิธีทำเจอ ยังใงขอบคุณเว็บตัวอย่าง htaccess เว็บนี้มากค่ะ

Leave a Reply