ขันตอนแรกของการทำ 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
