You may need to change your domain name to a new domain for several reasons. In such cases, you need search engine find your new web site and index it. The best way to do is set 301 redirect from your old site to new domain name.
When you change your domain name, you should never keep the pages in your old domain as it will result in duplicate content and affect your search ranking.
You can do 301 redirect of your existing web pages to new domain name with .htaccess files. To do this, create a file with name ".htaccess" with following content.
RedirectMatch 301 ^(.*)$ http://www.newdomain.com/$1