如何使用.htaccess进行url重写?

enter image description hereI used .htaccess for url rewrite.These code used.

RewriteRule  ^products/([0-9]+)/?$    search.php?srhCat=$1    [NC,L]    # Handle product requests

These rule is ok to call php file.But other css,image path is wrong. How to solve these error.

Based on your URL rewrite, the path now changes to

http://localhost/superpages/products/4

It will then attempt to load your assets on:

http://localhost/superpages/products/4/js/sample.js http://localhost/superpages/products/4/css/sample.css http://localhost/superpages/products/4/images/sample.jpg

You may check your browser's debug console to check where those assets are being loaded. You may expect to see a 404 error on the said assets. You may fix this by providing the document root path preceding the asset file.

In your html if you are using relative paths for the js, images, css than their paths should begin with /:

 <img src="/<path to the image>">

If you add the html code of the page or the failed requests for css and image files it would help.