Cấu hình CleanURL cho Drupal
Để thiết lập chế độ Clean URL cho Drupal, trước tiên ta phải bật module rewrite cho apache:
$> cd /etc/apache2/mods-enabled
$> ln -s ../mods-available/rewrite.load ./
$> /etc/init.d/apache2 restart
Tiếp đó, cho phép sử dụng file .htaccess để sửa đổi thiết lập của thư mục web. Mở file /etc/apache2/site-enabled/<tên site>, sửa lại dòng AllowOverride từ None thành All.
Cuối cùng, ta tạo 1 file .htaccess để bật module Rewrite lên cho Drupal. File có nội dung như sau:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
leave a comment