I'm while using following to redirect www.olddomain.com and olddomain.com to www.newdomain.com

But when I attempt olddomain.com it provides me with a 500 Internal server error. Redirection of www.oldomain.com works fine:

RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/ [R=301,L]

RewriteCond %{HTTP_HOST} ^www.olddomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/ [R=301,L]

thank you for any help!