Because LosesToy uses a shared server, there is no way to set up 301 redirection through IIS or Apache.
1. 301 redirect code under ASP
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, “http://www.lesishu.cn/articles/301/”
%>
3. 301 redirect code under ASP.Net
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader("Location","http://www.lesishu.cn/articles/301/");
}
</script>
header ("HTTP/1.1 301 Moved Permanently")
under PHP
;
header(”Location: http://www.lesishu.cn/articles/301/ ”);
exit();
5. 301 redirect code under CGI Perl
$q = new CGI;
print $q->redirect(”http://www.new-url.com/”);
6. 301 redirect code under JSP
<%
response.setStatus(301);
response.setHeader( “Location”, “http://www.lesishu.cn/” );
response.setHeader( “Connection”, “close” );
%>
7.
Create a new .htaccess file for the 301 redirection code under Apache and enter the following content (mod_rewrite needs to be turned on):
1) Redirect the domain name without WWW to the domain name with WWW
Options + FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^lesishu.cn [NC]
RewriteRule ^(.*)$ http://www.lesishu.cn/$1 [L,R=301]
2) Redirect to the new domain name
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.lesishu.cn/$1 [L,R=301]
3) Use regular rules to perform 301 redirection and implement pseudo-static
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^news-(.+).html$ news.php?id=$1
redirects addresses like news.php?id=123 to news-123.html