1、IIS下301配置
Internet信息处事打点器 -> 假造目次 -> 重定向到URL,输入必要转向的
方针URL,并选择“资源的永世重定向”。
2、ASP下的301转向代码
<a target=asp实现301跳转代码" src="http://host.zzidc.com/uploads/allimg/141112/1-141112114341b3.jpg" style="border-top: medium none; height: 263px; border-right: medium none; width: 562px; white-space: normal; word-spacing: 0px; border-bottom: medium none; text-transform: none; color: rgb(51,51,51); padding-bottom: 0px; padding-top: 0px; font: 12px/18px 宋体, Tahoma, SimSun-ExtB; padding-left: 0px; margin: 0px; border-left: medium none; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/>
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.zzidc.com/"
%>
3、ASP.Net下的301转向代码
<a target=asp.net 301跳转代码" src="http://host.zzidc.com/uploads/allimg/141112/1-141112114453T6.jpg" style="border-top: medium none; height: 339px; border-right: medium none; width: 560px; white-space: normal; word-spacing: 0px; border-bottom: medium none; text-transform: none; color: rgb(51,51,51); padding-bottom: 0px; padding-top: 0px; font: 12px/18px 宋体, Tahoma, SimSun-ExtB; padding-left: 0px; margin: 0px; border-left: medium none; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.zzidc.com/");
}
</script>
4、PHP下的301转向代码
<a target=php 301跳转代码" src="http://host.zzidc.com/uploads/allimg/141112/1-14111211460J41.jpg" style="border-top: medium none; height: 187px; border-right: medium none; width: 558px; white-space: normal; word-spacing: 0px; border-bottom: medium none; text-transform: none; color: rgb(51,51,51); padding-bottom: 0px; padding-top: 0px; font: 12px/18px 宋体, Tahoma, SimSun-ExtB; padding-left: 0px; margin: 0px; border-left: medium none; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/>
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.zzidc.com/");
exit();
5、CGI Perl下的301转向代码
CGI Perl 301跳转代码
$q = new CGI;
print $q->redirect("http://www.zzidc.com/");
6、JSP下的301转向代码
JSP 301跳转代码
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.zzidc.com/" );
response.setHeader( "Connection", "close" );
%>
7、Apache下301转向代码
新建.htaccess文件,输入下列内容(必要开启mod_rewrite):
1)将不带WWW的域名转向到带WWW的域名下
Apache 301跳转代码
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^lesishu.cn [NC]
RewriteRule ^(.*)$ http://www.zzidc.com/$1 [L,R=301]
2)重定向到新域名
Apache 301跳转
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.zzidc.com/$1 [L,R=301]
3)行使正则举办301转向,实现伪静态
Apache 301代码
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^news-(.+)\.html$ news.php?id=$1
相关文章
预留评论插件