Wednesday, June 22, 2011

Linux: Add Mod_Rewrite to Apache2

1. ตรวจสอบว่า server ของเราติดตั้ง mod_rewrite แล้วหรือยังด้วย phpinfo(); ใน php file
แล้ว search หา mod_rewrite ถ้าไม่เจอก็แสดงว่ายังไม่มี

2. run Terminal แล้วพิมพ์ command line ต่อไปนี้

chan@laptop:~$ sudo a2enmod rewrite
[sudo] password for chan:
Enabling module rewrite.
Run '/etc/init.d/apache2 restart' to activate new configuration!
chan@chan-dell-laptop:~$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
chan@laptop:~$

3. ทดสอบ phpinfo อีกครั้งจะพบว่ามีการติดตั้ง mod_rewrite แล้ว

No comments: