1, IIS under 301 settings
Internet Information Services Manager-> virtual directory-> to a URL, enter the destination URL that needs to be redirected, and select Permanent redirect for resources.
In IIS, you can also implement features such as Mod_rewrite in Apache by installing the ISAPI Rewrite component, as described in the ISAPI Rewrite 3 download and the common 301 rules.
2, ASP under the 301 redirect Code
<%@ Language=vbscript%>
<%
Response.status= "Moved Permanently"
Response.AddHeader "Location", "106/"
%>
3, ASP. NET 301 REDIRECT Code
<script runat= "Server" >
private void Page_Load (object sender, System.EventArgs e)
{
Response.Status = "Moved Permanently";
Response.AddHeader ("Location", "106/");
}
</script>
4, PHP under the 301 redirect Code
Header ("http/1.1 moved Permanently");
Header ("location:106/");
Exit ();
5.301 redirect Code under CGI Perl
$q = new CGI;
Print $q->redirect ("");
6, JSP under the 301 redirect Code
<%
Response.setstatus (301);
Response.setheader ("Location", "");
Response.setheader ("Connection", "close");
%>
7, Apache under 301 redirect Code
Create a new. htaccess file and enter the following (you need to turn on mod_rewrite):
1 Change the domain name without www to the domain name with www
Options +followsymlinks
Rewriteengine on
Rewritecond%{http_host} ^embeta.com [NC]
Rewriterule ^ (. *) $ $ [l,r=301]
2 Redirect to new domain
Options +followsymlinks
Rewriteengine on
Rewriterule ^ (. *) $ $ [l,r=301]
3) using regular 301 steering to achieve pseudo static
Options +followsymlinks
Rewriteengine on
Rewriterule ^news-(. +) \.HTML1
Turn news.php?id=123 Such an address to news-123.html
8, Apache under the vhosts.conf configuration 301 redirect
In order to achieve URL normalization, SEO will usually change the domain name without www to the WWW domain name, vhosts.conf is configured as:
<virtualhost *:80>
ServerName Documentroot/home/embeta
</VirtualHost>
<virtualhost *:80>
ServerName embeta.com
Redirectmatch permanent ^/(. *) $
</VirtualHost>