3xx codes are a class of responses that suggest the User-Agent must follow another course of action to obtain the complete requested resource.
Basically these response codes tell a user and a crawler that a particular page has been moved to another URL, it may be permanent or temporary depends on what the website admin wants.
2.Redirect Location should be set in either:
1.Location header field in the response, useful for automatic redirecting
2.The payload of the response with a hyperlink (optional) to correction location
But, now days hosting provider has made very easy to redirect a particular site through integrated C-Panel. You can easily manage and view which URL redirects from which URL.
3.301 (Moved Permanently):
Permanent URL redirect for the resource requested. The target resource has been assigned a new permanent URL and any future references to this resource ought to use one of the enclosed URLs.
This is mainly used for migration of a particular site along with the site each and every element will get the transfer, page rank, backlink equity, Link Juice, etc.
3.302 (Temporary Redirect):
Similar to a 301 redirect, but is intended for temporary purposes only.
This is basically used for A/B testing.
307 (Temporary Redirect):
A redirect similar to a 302 response except that the request method (e.g. GET, POST..) must not differ from what was used in the original request if automatically following the redirect.
This is also used for migration temporarily to analyze penalty and other issues if there is any. By implementing this response code backlink equity, PageRank and modularity will not pass.
On your old domain website, open up the
Add the line:
redirect 301 / http://www.new domain.com/
to the .htaccess file at the top.
Change the URL http://www.new domain.com/ to the new domain name, you’re redirecting to.
Save the file to the root of your old website
Log into your cPanel.
Click the Redirects link in the Domains section.
In the Type, section chooses if you want to create a Permanent (301) or Temporary (302) redirect. Generally, any redirects will be Permanent (which is the default).
In the next drop-down choose the domain you want to forward.
If you want to redirect a specific file (such as info.html) enter it in the blank forward slash ‘/’ field.
In the Redirects to box enter the domain, you want the traffic redirected to.
In the “www. redirection” section choose how you want to handle ‘www’ redirects. The www redirection option allows you to configure how to handle redirects in regard to the www subdomain.
Once you are done, click on “Add”: