We are assuming that your web server uses Apache for the purpose of this tutorial. If you have not made any changes to your overall site structure, but have simply relocated the site in its current state, you can add the following lines to your .htaccess file located at the root of your old domain:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>
If you have made changes to your site structure, you can still use the lines above on your old domain, but you will also need to create redirects in the .htaccess file on your new domain to handle the specific site changes.
To redirect a single page to a new location on the same domain, use the following syntax:
Redirect 301 /old/old.htm http://www.domain.com/new.htm