The best method is the so called
301 redirect as in this way you also tell the search engines that the page in question has been moved permanently (302 is temporary and is very risky for SEO purposes).
Here are the ways to do it:
Examples using .htaccessRedirect 301 /oldfolder http://www.toanewdomain.com
Redirect 301 /oldurl.html http://www.yourdomain.com/newurl.htmlIf your server has windows then use it this way on the file that is being moved:
For windows server<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.dindomän.se/och-kanske/nya-dokumentet.html"
%>You can also use PHP or ASP for this and then just add these lines at the top of the file:
PHPheader("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomain.com/newdir/newpage.htm");
exit();ASP 301<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.newdomain.com/newdir/newpage.asp"
response.end
%>Redirect using meta refresh or javascript is
not recommended and may even be harmful as this method has been used a lot by spammers and is most likely making the search engines penalising your site.