Welcome to WebmasterWorld Guest from 188.8.131.52
rewrite oldsite.* to newsite.* [r=301]
I'm not sure about the proper syntax but what it does is redirects oldsite/pagename.htm to newsite/pagename.htm for whatever page is requested, that is if the old and new sites are the same.
Find out how in the apache forum if you run apache.
the proper HTTP status code would be 301 'page has moved permanently'
should I 301 redirect all of the pages on site b to site a? Or should I only 301 the index page and 404 all the other pages
You should issue a 301 on all of the pages on your old site pointing to the same page on the new site.
If you have re-arranged your new site and removed some pages, you should issue a 410 for the pages on site b that no longer exist on site a