Setting up a permanent 301 redirect
Redirect individual files
redirect individual files, like “example.com/oldfile.htm” to “newfile.htm“ you can use a 301 redirect such as this
Redirect 301 /oldfile.htm /newfile.htm
Redirect an old domain to a new domain
If you had an old domain such as “example.com”, and now you to change your domain to say “newsite.com” for the website. You could setup a 301 redirect for the entire domain, so that old links to “example.com” carry over.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://newsite.com/$1 [L,R=301,NC]