web, trends and thinking It just another weblog :P เปิดใช้ Mod Rewrite หรือ .htaccess บน Apache
หน้าแรก PHP MySQL เกร็ดความรู้ web, trends and thinking It just another weblog :P เปิดใช้ Mod Rewrite หรือ .htaccess บน Apache
ใครที่ใช้เครื่องตัวเองจำลอง Server อยู่นี่เป็นวิธีการไปปรับตัว Apache Server ครับ (+AppServ) ในที่นี้ผมใช้ Windows Xp เป็นตัวอย่าง
ไปที่โฟลเดอร์ conf ของ Apache แล้วเปิดไฟล์ httpd.conf ขึ้นมา
เช่น C:/Apache/conf หรือใน Appserv ก็ C:/AppServ/Apache2.2/conf
ทีนี้หา #LoadModule rewrite_module modules/mod_rewrite.so ให้เจอครับ แล้วลบตัว # ออกไป
หลังจากนั้นไปตั้งค่าในโฟลเดอร์ที่แสดงผลเว็บ อย่างใน AppServ ก็คือตรง C:/AppServ/www ก็จะเป็น
| Code |
| <Directory C:/AppServ/www> Options Indexes FollowSymLinks MultiViews ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> |
หรือบางคนอาจลง Apache เองก็จะเป็น <Directory C:/www> หลายคนอาจไปปรับตรง <Directory /> มันก็อาจจะไม่ทำงานให้เพราะตรงส่วน www ที่แสดงผลเว็บเราไม่ได้ถูกปรับไปด้วย ลองดูดีๆด้วยล่ะครับ
Restart ตัว Apache Server ครับ
refer: http://nt99.wordpress.com/2010/10/04/%E0%B9%80%E0%B8%9B%E0%B8%B4%E0%B8%94%E0%B9%83%E0%B8%8A%E0%B9%89-mod-rewrite-%E0%B8%AB%E0%B8%A3%E0%B8%B7%E0%B8%AD-htaccess-%E0%B8%9A%E0%B8%99-apache/
ขึ้นไปด้านบน
