久久国产亚洲日韩一本,欧美日韩专区国产精品,久久精品成人欧美大片,久久久久久久岛国免费AV,亚洲欧洲精品一区二区

新聞建站cms系統、政府cms系統定制開發

廣州網站建設公司-閱速公司

asp.net新聞發布系統、報紙數字報系統方案
/
http://www.ainiby.com/
廣州網站建設公司
您當前位置:首頁>網站技術

網站技術

利用IIS目錄改版實現301轉向(全站重定向)

發布時間:2014/10/15 20:27:24  作者:Admin  閱讀:558  

廣告:

1. 利用程序跳轉

asp.net 3.1

#region 301轉向

public static void To301(string path)

{

HttpContext.Current.Response.Clear();

HttpContext.Current.Response.StatusCode = 301;

HttpContext.Current.Response.AppendHeader("location", path);

HttpContext.Current.Response.End();

}

#endregion

asp 301

<%@ Language=VBScript %>

<%

Response.Status=”301 Moved Permanently”

Response.AddHeader “Location”, “http://www.****.cn/articles/301/”

%>

php 301

header(”HTTP/1.1 301 Moved Permanently”);

header(”Location: http://www.****.cn/articles/301/”);

exit();

jsp 301

<%

response.setStatus(301);

response.setHeader( “Location”, “http://www.****.cn/” );

response.setHeader( “Connection”, “close” );

%>

2. 利用服務器iis實現轉向

iis,在要轉向的目錄(原目錄不要刪)右鍵,屬性-重定向到url,如:加$s$q參數

http://demo.53bk.com/shouji$S$Q  (注意:S和Q一定要大寫,不然不生效)

上面準確的url和資源永久重定向打勾。

3. IIs8.5和iis 7.5 :

要建一個目錄:里面web.cofig

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="http://zaoyuan.ysneo.com$S$Q" exactDestination="true" httpResponseStatus="Permanent" />
</system.webServer>
</configuration>

http重定向---將請求重定向到此目標---http://www.ainiby.com$S$Q (將所有請求重定向到確切的目標(而不是相對于目標)打勾,狀態代碼設為永久( 301))

4、Apache下301轉向代碼

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

1)將不帶WWW的域名轉向到帶WWW的域名下

Options +FollowSymLinks

RewriteEngine on

RewriteCond %{HTTP_HOST} ^lesishu.cn [NC]

RewriteRule ^(.*)$ http://www.****.cn/$1 [L,R=301]

2)重定向到新域名

Options +FollowSymLinks

RewriteEngine on

RewriteRule ^(.*)$ http://www.****.cn/$1 [L,R=301]

3)使用正則進行301轉向,實現偽靜態

Options +FollowSymLinks

RewriteEngine on

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

將news.php?id=123這樣的地址轉向到news-123.html

5、Apache下vhosts.conf中配置301轉向

為實現URL規范化,SEO通常將不帶WWW的域名轉向到帶WWW域名,vhosts.conf中配置為:

<VirtualHost *:80>

ServerName www.****.cn

DocumentRoot /home/lesishu

</VirtualHost>

<VirtualHost *:80>

ServerName lesishu.cn

RedirectMatch permanent ^/(.*) http://www.****.cn/$1

</VirtualHost>

 

 

廣告:

相關文章
iis轉向
301轉向
cms新聞系統購買咨詢
掃描關注 廣州閱速軟件科技有限公司
掃描關注 廣州閱速科技
主站蜘蛛池模板: 屯门区| 兴义市| 商都县| 永康市| 葵青区| 永善县| 古田县| 理塘县| 甘南县| 平乐县| 昆明市| 长海县| 康定县| 宣武区| 禄丰县| 葫芦岛市| 广宗县| 陵川县| 凉山| 大埔区| 泸州市| 北京市| 灵璧县| SHOW| 靖西县| 琼中| 鹤岗市| 哈尔滨市| 新干县| 黄陵县| 遵义县| 津南区| 双江| 德化县| 岳阳市| 来宾市| 安塞县| 沿河| 庄浪县| 渝中区| 方山县|