Calendar

July 2010
S M T W T F S
« Jun    
 123
45678910
11121314151617
18192021222324
25262728293031

How to set clean Urls by using mod_rewrite for drupal 6.x

ขันตอนแรกของการทำ SEO ใน drupal จากที่อ่านมา เค้าบอกให้ทำการ enable clean URLs แต่ว่าใน drupal 6.x นี้เองจะสามารถทำได้ก็ต่อเมื่อ host ของเรารองรับการทำ clean urls โดยต้องไปติดตั่ง mod_rewrite ซึ่งปกติน่าจะติดกันมาอยู่แล้ว แล้วก็ไปทำการ enable ให้มันทำงานได้โดย

1. เปลี่ยนชื่อไฟล์ .htpaccess ให้เป็น htpaccess.conf สมมุติว่าไฟล์นี้ของผมที่อยู่ /var/www/drupalsite/.htaccess

mv /var/www/drupalsite/.htaccess /var/www/drupalsite/htaccess.conf

2. จากนั้นไปแก้ไฟล์ vhost ของ apache ให้เปิด mod_rewrite แล้วทำการ Include ไฟล์ htpaccess.conf ดังกล่าวไป

<VirtualHost *>
        ServerName drupalsite.example.com
        DocumentRoot /var/www/drupalsite
        <Directory /var/www/sdrupalsite>
                Order allow,deny
                Allow from all
                RewriteEngine On
                AllowOverride All
 
                # Instead of reading .htaccess rules on the fly every page,
                # Include them once, now, in this directory context
                Include /var/www/drupalsite/htaccess.conf
        </Directory>
</VirtualHost *>

แค่นี้ drupal 6.x ของเราก็ทำการ enable clean URLs ได้แล้วครับ
ที่มา http://drupal.org/node/43788

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • Live
  • MySpace
  • PDF
  • RSS
  • Twitter
  • Yahoo! Bookmarks
  • email

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">