301 redirect tells search engine and other users that old link is replaced by new link. There are many different kind of 301 redirection.
Redirect individual files on the same domain
To make this kind redirection you need to open .htaccess file and put this code.
Redirect 301 /oldfile.htm /newfile.htm
Redirect individual files on the other domain
Redirect 301 /oldfile.htm http://demo.net/newfile.htm
Redirect an old domain to a new domain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^demo.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.demo.com [NC]
RewriteRule ^(.*)$ http://demo.net/$1 [L,R=301,NC]
Force www. version of domain to be used
RewriteEngine on
RewriteCond %{HTTP_HOST} ^demo.com [NC]
RewriteRule ^(.*)$ http://www.demo.com/$1 [L,R=301,NC]
Force non www. version of domain to be used
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.demo.com [NC]
RewriteRule ^(.*)$ http://demo.com/$1 [L,R=301,NC]
Redirect all files with certain extension
To re-direct all of one type of file to another, such as demo.com/file.php to demo.com/file.htm
RewriteEngine On
RewriteCond %{REQUEST_URI} .php$
RewriteRule ^(.*).php$ /$1.htm [R=301,L]