|
首页
>> 帮助中心>> 虚拟主机相关问题 |
|
|
301转向(或叫301重定向,301跳转)是当用户或搜索引擎向网站服务器发出浏览请求时,服务器返回的HTTP数据流中头信息(header)中的状态码的一种,表示本网页永久性转移到另一个地址。 怎样做301转向? 在安装伪静态组件后,在组件配置文件httpd.ini中加入如下代码即可 需要空间支持ISAPI_Rewrite(我公司虚拟主机直接在网站根目录新建httpd.ini文件填写以下内容)
以下是引用片段: [ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RewriteCond Host: ^yourname\.com$ RewriteRule (.*) http\://www\.yourname\.com$1 [I,RP] |
Windows 2008主机 在网站根目录下新建web.config文件填写以下内容 <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <defaultDocument> <files> <clear /> <add value="index.html" /> <add value="index.html" /> <add value="index.php" /> <add value="Default.htm" /> <add value="Default.html" /> <add value="index.htm" /> <add value="iisstart.htm" /> <add value="default.htmlx" /> </files> </defaultDocument> <rewrite> <rules> <rule name="Redirect" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^wvidc.com$" /> </conditions> <action type="Redirect" url="https://www.wvidc.com/{R:0}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration> 这样实现了 yourname.com重定向到www.yourname.com
打印
|
|
| |