# Turn on URL rewriting
RewriteEngine on
# Put your installation directory here:
#If root directory for domain is started as sub-directory Example => www.domain.com/rewrite/
#RewriteBase /rewrite/
#If root directory for domain is started as root-directory Example => www.domain.com
RewriteBase /
# Rewrite all other URLs to index.php/URL
RewriteRule ^([0-9]+)/(.+)\.html$ post.php?id=$1&title=$2 [NC]
Quote:
Example URL : http://www.domain.com/1/ทดสอบ-กระทู้.html
Code (PHP)
<?php
header('Content-Type:text/html; charset=utf-8;');
echo 'Getting all variable request is : <br/>';
echo '<pre>';
var_dump($_GET);
echo '</pre>';
?>
Quote:
Result
Getting all variable response is :
array
'id' => string '1' (length=1)
'title' => string 'สวัสดี-ประเทศไทย' (length=46)