This is my code for test.php
.
<?PHP
include("connect.php");
$id_val = mysqli_real_escape_string($db_mysqli,$_GET['id_val']);
echo $id_val;
?>
This is my mod rewrite code (.htaccess
)
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
RewriteRule ^(.*)$ $1.php [L]
RewriteRule ^test/([^-]*)$ /test.php?id_val=$1 [L]
DirectoryIndex index.php
When i tried to access
www.example.com/test/8-pi7Tvu66
It's not working. (It's will be redirect to index.php and not echo anything.)
But when i tried to access
www.example.com/test.php?id_val=8-pi7Tvu66
It's work good. (echo 8-pi7Tvu66)
How can i do for work good on mod rewrite URL ?
www.example.com/test/8-pi7Tvu66
...
Remark : I still tried to test on id_val that not contain (-)
eg:
www.example.com/test/8pi7Tvu66
And it's work good. (echo 8pi7Tvu66)