网站301重定向代码大全
1、2003系统保存为httpd.ini上传至根目录,2008系统保存为web.config上传至根目录
2、域名huakungzs.com做301重定向至www.huakungzs.com举例:
3、windows2003系统:
[ISAPI_Rewrite]RewriteCond Host: ^(?:www\.)?huakungzs\.com$RewriteRule ^/(.*)$ http://www\.huakungzs\.com/$1 [L,RP]
4、windows2008系统:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="sudu_rewritefunc_unifieddomainname" enabled="true" patternSyntax="ECMAScript" stopProcessing="false">
<match url="(.*)" ignoreCase="true" negate="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" matchType="Pattern" pattern="^huakungzs.com$" ignoreCase="true" negate="true" />
</conditions>
<action type="Redirect" url="http://www.huakungzs.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite></system.webServer>
</configuration>