My URLs look like "/pages.php?page=pageName" because I am using a database to supply the page's content. Does rewriting URLs to something like "/pageName" help search engines find the pages? If so how do I rewrite them?
It doesn't help the search engines find the page easier (in fact if not implemented properly it can make it harder for the search engines to crawl your site) but if done properly it will make your pages rank better for their relevant keywords
For PHP look at mod_rewrite for Apache
I'm not a regex expert but it uses pattern matching rules to perform the rewrite, there will be lots of documentation and tutorials online for mod_rewrite
Maybe a better question is "Does rewriting a URL help a user find the page in a search engine?". And the answer to this is "yes". For example, let's say that the content of your page discusses dolphins. Google puts more weight for the search term "Dolphins" into:
/Dolphins.php
than
/pages.php?page=1323
You'll find this is what most modern websites are doing (including stackoverflow).
It probably doesn't help a crawler to find the pages, but it may have a positive impact in how it's going to rank them, as better URIs get usually better ranking (other things being equal, of course). It's also good to have them permanent.
About how you have mod_rewrite in Apache world and some other options in IIS world.
Example (Apache's syntax):
RewriteEngine On
RewriteRule ^(.*)$ pages.php?page=$1
That will pass everything in the URI after the domain name (there's a caveat regarding the trailing slash) to pages.php as a page parameter.
This is
http://yourdomain.com/bears
will return the content as served by
http://yourdomain.com/pages.php?page=bears
It won't help the search engines to find them more easily. To make sure the search engines find your pages, the two most important things you can do are:
Create a sitemap, reference it in your robots.txt, and register it with Google WebMaster tools
Make sure you actually have spiderable, non-javascript links (preferably text links) to all the pages on your site.
You can create .htaccess file in root of site and add this into file:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/pages/(.*) pages.php?page=$1
The search engines will like your pages a lot more. If there is a dynamic file ending and a querystring, most search engines thinks it's a dynamic page, which will change soon, and therefore won't rank it as high as static pages.
Then you've got the rewrite in place, you can easily parse it in your PHP and decide your url structure with php.
Check out this blog entry from google.
Specially this quote.
One recommendation is to avoid reformatting a dynamic URL to make it look static
Would like to emphasis the need for an extension to the page, e.g. .html and the fact that slashes inside the url are interpreted as virtual directory paths inside the site's "tree map".
There is more "weight" as Keltex said in paths like category.html than /category/subcategory.html
Anyways it is mandatory to implement the friendly urls along with a sitemap. All that combined with basic SEO title,proper headings gives you a nice result.