Check out the following web calculator that generates various htaccess redirects:
http://www.htaccessredirect301.com/
The following are generated:
seo 301 redirect path
seo #301 Redirect Entire Old directories
seo 301 redirect directory (all directory content)
seo 302 redirect path
non www to www (http://yousite.com to http://www.yousite.com Site Url eg mysite.com
www to non www (http://www.yousite.com to http://yousite.com Site Url eg mysite.com
Custom 400 error
400 Error path
Custom 401 error
401 Error redirect webpage
Custom 403 error
403 Error redirect url
Custom 404 error
404 Error redirect page
Custom 500 error
500 Error page
change default page (index.htm to home.php).
Enter what you want to use as your default page
Block ip or deny ip ip address or ip addresses separeted by comma
Allow ip or Allow some ip and deny others
ip address or ip addresses separeted by comma
Password protect a file or directory Enter file name
Enter htpasswd path
Turn on file commpression (gzip) to decrease page size and increase loading speed
cache images , css files and pages to increase page loading speed
public private must-revalidateEnter File extension or extensions separated by comma css,gif
Prevent viewing of .htaccess
change https to http Full site name http://www.mysite.com
Prevent directory listing
prevent bandwidth stealing or hotlink protection