As a result of the spreading SEO awareness and how Google works, it is always recommended to use as less dynamic URLs as possible for your site. If one must, try using as less variables in the dynamic URL as possible.
A dynamic URL is one with a question mark that passes dynamic variables to the script in the form of http://www.somesite.com/somescript.php?var1=value1&var2=value2. It’s not only ugly but also does no good in terms of search engine optimization. So how can we build php query strings without question mark so that search engines would treat them as static URLs?
Let’s take somesite.com for example. We are going to build a query string that works exactly like http://www.somesite.com/somescript.php?var1=value1&var2=value2 but without the question mark. To make this happen, you need to tamper with .htaccess at the document root of this domain. Add the following rewrite rules:
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^/somescript.php/(.+)-(.+)_(.+)-(.+)$ /somescript.php?$1=$2&$3=$4
We have used a bit of regular expressions which you can get more information about at here.
With the rewrite rule we have come up with, the apache server then redirects all incoming requests in the form of /somescript.php/a-1_b-2 to /somescript.php?a=1&b=2, successfully rewriting the URLs from dynamic ones to static ones. Then you can use the new rewritten URL on your site and visitors and search engine crawlers would only know about the rewritten ones instead of the real ones.
For more information about how you can play with rewrite rules, visit the apache mod_rewrite document.