我们大家做网站都会遇到,访问不带www也能访问,访问带www也能访问,对于搜索引擎来说是俩个URL页面呢,这就容易造成权重分散,因此我们要对域名进行301重定向,实现不带www跳转带www访问。
.htaccess
RewriteCond %{http_host} ^556z.com [NC]//如果是以根域名访问的
RewriteRule ^(.*)$ https://www.556z.com/$1 [L,R=301]//重定向到www并请求地址不变
Web.config
<rule name="301Redirect" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^556z\.com$" />
</conditions>
<action type="Redirect" url="https://www.556z.com/{R:0}" redirectType="Permanent" />
</rule>
Nginx
server {
listen 80;
server_name umtheme.com;
return 301 http://www.556z.com$request_uri;
}
js跳转
<script language="javascript">
if (document.domain =="umtheme.com")
this.location = "http://www.556z.com" + this.location.pathname + this.location.search;
</script>
广告插入