凌的博客

您现在的位置是: 首页 > Seo优化 > 程序界 > 

程序界

域名301跳转 web.config / .htaccess

2015-12-15 程序界 804
//apache 伪静态设置 .htaccess RewriteEngine On RewriteCond %{HTTP_HOST} !^www.yetyun.com$ [NC] RewriteRule ^(.*)$ http://www.yetyun.com/$1 [L,R=301]
//apache 伪静态设置 .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.yetyun.com$ [NC]
RewriteRule ^(.*)$ http://www.yetyun.com/$1 [L,R=301]
</IfModule>
//iis 7 伪静态设置 web.config
<?xml version="1.0"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="WWW Redirect" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^yetyun.com$" />
          </conditions>
          <action type="Redirect" url="http://www.yetyun.com/{R:0}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

文章评论

0条评论