I have a question and i cannot find the answer anywhere . I mean: Now Url is that: http://www.example.com/product.php?task=list&category_id=16 http://www.example.com/product.php?task=show&id=295 Want to change: http://www.example.com/product/category/16/ or http://www.example.com/product/list/category/16/ http://www.example.com/product/show/295/ i know that i can do that from the .htaccess file, but i've tryed and tryed and i just won a 500 Internal Server Error i hope some of you can help me thanks!!
Ok, think of the problem the other way around. Your public URL will be... http://www.example.com/product/category/16/ But, internally, on your server, you want to treat it as if it were... http://www.example.com/product.php?category_id=16 So, the code is... RewriteEngine on RewriteRule ^category/([0-9]+)/ product.php?category_id=$1 The bit in brackets forms $1, and says look for *anything* followed by the word category, followed by a slash, followed by any number of digits. Take those digits and stuff them into $1. Then replace all of that with product.php?category_id= and add on the numbers you first thought of. Thinking of it like that, you can add in other parameters such as your "task" parameter quite easily. Another set of brackets will give you $2.
If you have a problem with it still, then you may need to add the following: under the RewriteEngine on, place - RewriteBase / If you're still having trouble, then after the last RewriteURL, place [L]