I am trying to set up a redirect 301 and have tried several methods which appears to be all wrong. Can anyone advice exactly how redirect 301 works?

redirect 301 http://newdomain.com/

redirect 301 / http://newdomain.com/

redirect 301 http://olddomain.com/ http://newdomain.com/
redirect 301 http://www.olddomain.com/ http://newdomain.com/

redirect 301 /^(.*)$ http://newdomain.com/$1

Ideally, http://olddomain.com goes to http://newdomain.com and http://olddomain.com/example.html will go to http://newdomain.com/example.html

Can I do all this without the RewriteEngine On?

PS: If there's any documentation I'll be glad to do my own homework. Thanks.

You don't need the 301 in the redirect line, this would work: redirect / [url]http://newdomain.com/[/url] or if you want it permanent: redirect permanent / [url]http://newdomain.com/[/url] If your wanting to use mod-rewrite you can do the following:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=permanent,L]