You don't need to use mod_rewrite.
If you want to create the format like http://domain.com/filename/id then do this:
Create a PHP file called 'filename' without the .php extension. This will receive the request
Next, open the .htaccess file and insert this line:
Code:
<FilesMatch filename>
ForceType application/x-httpd-php5
</FilesMatch>
This forces Apache to execute any requests for filename as PHP rather than look for the directory.
Finally, in your 'filename' file add the following code and modify it to do the correct thing with the received id:
PHP Code:
<?php
//get URL requested
$expl = explode("/",$HTTP_SERVER_VARS["REQUEST_URI"]);
//Find ID in URL
$id = intval($expl[count($expl)-1]);
//Check ID found, otherwise redirect to homepage
if(!$id){
header("location: /");
die();
}
//Do something with $id, probably not redirect like this though
header("location: /filename.php?id=" . $id);
?>