同桌上课用手指进去了好爽_欧美丰满熟妇xxⅹⅹ性大i_成人av天天日天天拍拍_猛男gay帅男gay男男同志_欧美va天堂在线观看_人妻无码av中文系列三里桃花_亚欧免费无码在线观看_久久久精品国产亚洲av水_日韩在线免费看污污污_2021无码专区人妻系列日韩

首頁 優(yōu)化推廣 301設置方法和轉(zhuǎn)向代碼

301設置方法和轉(zhuǎn)向代碼

來源: | 時間:2010/7/20 15:18:56 |

1、IIS下301設置

Internet信息服務管理器 -> 虛擬目錄 -> 重定向到URL,輸入需要轉(zhuǎn)向的目標URL,并選擇“資源的永久重定向”。

2、ASP下的301轉(zhuǎn)向代碼

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, “http://www.lesishu.cn/articles/301/”
%>

3、ASP.Net下的301轉(zhuǎn)向代碼

<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>

4、PHP下的301轉(zhuǎn)向代碼

header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://www.lesishu.cn/articles/301/”);
exit();

5、CGI Perl下的301轉(zhuǎn)向代碼

$q = new CGI;
print $q->redirect(”http://www.new-url.com/”);

6、JSP下的301轉(zhuǎn)向代碼

<%
response.setStatus(301);
response.setHeader( “Location”, “http://www.lesishu.cn/” );
response.setHeader( “Connection”, “close” );
%>

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

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

1)將不帶WWW的域名轉(zhuǎn)向到帶WWW的域名下

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

2)重定向到新域名

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

3)使用正則進行301轉(zhuǎn)向,實現(xiàn)偽靜態(tài)

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)向

為實現(xiàn)URL規(guī)范化,SEO通常將不帶WWW的域名轉(zhuǎn)向到帶WWW域名,vhosts.conf中配置為:

<VirtualHost *:80>
ServerName www.lesishu.cn
DocumentRoot /home/lesishu
</VirtualHost>

<VirtualHost *:80>
ServerName lesishu.cn
RedirectMatch permanent ^/(.*) http://www.lesishu.cn/$1
</VirtualHost>

服務熱線

153 8323 9821

功能和特性

價格和優(yōu)惠

網(wǎng)站和維護

推廣和優(yōu)化

微信服務號