อยากให้ Url จาก http://www.nganwatcafechiangmai.com/...rite/test_2.php?id=1
เปลี่ยนเป็น http://www.nganwatcafechiangmai.com/rewrite/test/1
ไม่ทราบเขียนแบบนี้ถูกรึป่าวค่ะ  เพราะตอนรันดูมันไม่เปลี่ยน Url ให้ค่ะ
คือเปิดการใช้งานไฟล์ .htaccess แบบนี้อะค่ะ
Options +FollowSymlinks
RewriteEngine on
 
RewriteRule ^test/([0-9][0-9])/$ test_2.php?id=$1

หน้าไฟล์ที่ทดสอบคือ test_1.php
<a href="test_2.php?id=1">ทดสอบการส่งค่าแบบ mod rewrite</a>
หน้าที่รับค่า คือ test_2.php
$id=$_GET['id'];
echo $id."ผลการทดสอบสำเร็จหรือไม่ ??";
กรกฎ วิริยะ 17 Aug 2010 13:41
ลองใช้ ^test/([0-9]+) ดูครับ

([0-9]+) หมายถึงตัวเลขตั้งแต่ 1 ตัว ครับ
surepee doungthworn 12 Jun 2019 09:14
ลองเปลี่ยนดูแล้วค่ะ  กลายเปน  Internal Sever Error the server encountered an internal error or misconfiguration and was unable to complete your requet
กรกฎ วิริยะ 12 Jun 2019 09:20
RewriteRule ^rewrite\/test\/([0-9]+) ./rewrite/test_2.php?id=$1
ลองปรับดูนะครับ บางทีอาจต้องอ้าง path ให้ถูกต้องตั้งแต่ root
Penthai [PHP] Khum 12 Jun 2019 09:21
หน้าไฟล์ที่ทดสอบคือ test_1.php
test/13
ทดสอบการส่งค่าแบบ mod rewrite
ไม่ใช่หรอครับ ตรง rewrite ก็น่าจะเป็น
RewriteRule ^test/([0-9]+) test_2.php?id=$1