Simple redirect rule

sorry to bother again, but I am tearing my hair out!
is this the right rule for redirecting to the /main directory?
RewriteEngine on

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

It jsut does not want to work!
and it did before, that is frustrating!
Thanks again

This will redirect everything to the main directory, including a request for the main directory itself, which will cause an infinite loop!

What you need is


RewriteRule ^$ main [L,301]

or, if you are on Apache 1.x


RewriteRule ^/$ main [L,301]

do I need the rewrite conditions or just the rewrite rule?

How many domains is this website running on? If it’s just the one mentioned in the cond’s (one with www the other without) you’ll be fine with the just the rule.
If there are more domains you need the conditions as well.