There needs to be a space before the exclamation point in the first RewriteCond. This space is removed by posting on the board. You can get one to stay in your post if you type in two spaces.
The Options directive may be required if it is not already the default setting in your server configuration. However, on some server set-ups, the Options directive itself can cause a 500-Server Error.
Do not include a "$" end-anchor on the domain name pattern in the first RewriteCond. This can cause failures if anything (such as a port number) is appended.
This code will redirect all requests to domains other than www.mydomain.org back to www.mydomain.org, including a redirect for .com, .net, or any other TLD, and also for upper-case variants of .org.
All literal periods in the regular-expressions patterns need to be escaped by preceding them with a slash. Do not escape characters in the substitution (destination URL) string.