.htaccess为不同的动态页面重写url,例如category.php或subcategory.php或product.php

hi i want to know how to rewrite url for differ pages

for example:

http://example.com/category.php?cat=$category

in .htacces url i want like this example.com/category/

example.com/subCategory.php?cat=$category&subCat=$subCategory in .htacces url i want like this example.com/category/subcategory/

example.com/product.php?product=$product in .htacces url i want like this example.com/product/

thanx in advance

Using the rewrite engine and rewrite rules you can achieve this pretty easily.

RewriteEngine on
RewriteRule ^/category/([a-zA-Z0-9-]*)/?$ /category.php?cat=$1

Now just apply the same logic to your other scenarios.