亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

站長(zhǎng)必備的最齊全的301轉(zhuǎn)向代碼合集

 更新時(shí)間:2008年09月23日 14:13:12   作者:  
自腳本之家上次整理的301代碼轉(zhuǎn)向以后發(fā)現(xiàn)這個(gè)是最齊全的301轉(zhuǎn)向代碼
將SEO工作中所需要的301轉(zhuǎn)向代碼進(jìn)行了整理,收藏并分享,以備查閱。
1、IIS下301設(shè)置
Internet信息服務(wù)管理器 -> 虛擬目錄 -> 重定向到URL,輸入需要轉(zhuǎn)向的
目標(biāo)URL,并選擇“資源的永久重定向”。
2、ASP下的301轉(zhuǎn)向代碼
復(fù)制代碼 代碼如下:

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://chabaoo.cn/"
%>

3、ASP.Net下的301轉(zhuǎn)向代碼
復(fù)制代碼 代碼如下:

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://chabaoo.cn/");
}
</script>

4、PHP下的301轉(zhuǎn)向代碼
復(fù)制代碼 代碼如下:

header("HTTP/1.1 301 Moved Permanently");
header("Location: http://chabaoo.cn/");
exit();

5、CGI Perl下的301轉(zhuǎn)向代碼
復(fù)制代碼 代碼如下:

$q = new CGI;
print $q->redirect("http://chabaoo.cn/");

6、JSP下的301轉(zhuǎn)向代碼
復(fù)制代碼 代碼如下:

<%
response.setStatus(301);
response.setHeader( "Location", "http://chabaoo.cn/" );
response.setHeader( "Connection", "close" );
%>

7、Apache下301轉(zhuǎn)向代碼

新建.htaccess文件,輸入下列內(nèi)容(需要開啟mod_rewrite):

1)將不帶WWW的域名轉(zhuǎn)向到帶WWW的域名下
復(fù)制代碼 代碼如下:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^lesishu.cn [NC]
RewriteRule ^(.*)$ http://chabaoo.cn/$1 [L,R=301]

2)重定向到新域名
復(fù)制代碼 代碼如下:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://chabaoo.cn/$1 [L,R=301]

3)使用正則進(jìn)行301轉(zhuǎn)向,實(shí)現(xiàn)偽靜態(tài)
復(fù)制代碼 代碼如下:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^news-(.+)\.html$ news.php?id=$1

將news.php?id=123這樣的地址轉(zhuǎn)向到news-123.html
8、Apache下vhosts.conf中配置301轉(zhuǎn)向
為實(shí)現(xiàn)URL規(guī)范化,SEO通常將不帶WWW的域名轉(zhuǎn)向到帶WWW域名,
vhosts.conf中配置為:
[code]
<VirtualHost *:80>
ServerName chabaoo.cn
DocumentRoot /home/jb51
</VirtualHost>

<VirtualHost *:80>
ServerName jb51.net
RedirectMatch permanent ^/(.*) http://chabaoo.cn/$1
</VirtualHost>
[code]
Apache下除了以上2種方法,還有其他配置方法和可選參數(shù),建議閱讀
Apache文檔。

301轉(zhuǎn)向情況檢測(cè)

  1. http://www.seoconsultants.com/tools/headers.asp
  2. http://www.internetofficer.com/seo-tool/redirect-check/

相關(guān)文章

最新評(píng)論