网站301重定向代码大全

2025-10-26 13:29:31

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>

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢