Rewrite URL for PHP Containing Space and Dash

  Kiến thức lập trình

I need to update my website to have SEO friendly URLs. The website uses PHP and a MySQL database. The page in question takes a GET variable called cat (short for category) from the URL.

Here are a few examples of categories I need to work with. They can contain multiple spaces and dashes.

Hex Bolt

U-Bolt <- this category has a dash already

Tension Control Bolt

The current URL looks like this

Ultimately I would like the URLs to look like the following: <- leave the dash

I believe this involves an htaccess rule. How would you go about pulling this off where you could replace the dash back to a space vs keep the dash if it was initially a dash? If you could include the HTACCESS rule and any other handling needed on the PHP script(s). Thanks!