如何使用PHP删除.htaccess中的空间

This is php code

$category = $_GET['category'];
    $model = $_GET['model'];
    //connect to database

         mysql_connect('localhost','user','password');
         mysql_select_db('user');


    $result = mysql_query("SET NAMES utf8"); //the main trick
    $q=mysql_query("select * from data where category='$category' And model='$model' AND TRIM(model) IS NOT NULL");

    //Adds one to the counter
     mysql_query("UPDATE daata SET counter = counter + 1 where category='$category' And model='$model'");

     //Retreives the current count
     $count = mysql_fetch_row(mysql_query("SELECT counter FROM data"));
    $row=mysql_fetch_object($q);

    echo mysql_error();


    ?>

    <table class='hovertable'><?php if($row->model):?><tr class=\"style1\"><td width='200'><b>Model:</b></td><td><?php echo $row->model ?></td></tr><?php endif; ?>
    <?php if($row->category):?><tr class=\"style1\"><td width='200'><b>Category:</b></td><td><?php echo $row->category?></td></tr><?php endif; ?></table>

i am using this .htaccess file

.htaccess

RewriteOptions inherit
RewriteRule ^([a-zA-Z0-9_-]+)-([0-9]+)\.html$ detail.php?category=$1&model=$2

it is showing like this

abc-123.html

and suppose i have a space like this

abc-123 xyz.html

so it it is not working

and it is showing like this

abc-123%20xyz.html

but no result found

and i want like this if space is found then showing like this

abc-123-xyz.html

and if space is not found then showing like this

 abc-123.html

so how can i fix this issue

please help me to fix this issue thanks

Sounds like you're trying to have SEO/User-friendly urls... If that's the case, you must modify the generation of your urls and in case of a space substitute it for a character '-'. I don't understand what has this to do with .htaccess...

However, you don't specify the language, nor any detail how did you get those urls, so I'm afraid this is all help I can provide to your question in its current state.

If you want friendly URL, you are better of just capturing everything to ONE entry point (like index.php) and handling the URL inside the PHP, not on the .htaccess, specially because .htaccess is a lot slower than php.

Here is how I do:

http://www.prescia.net/bb/coding/5-141018-simple_friendly-url