开发者

Both www. and http:// websites are available 302

开发者 https://www.devze.com 2023-02-17 09:35 出处:网络
I am trying to optimize my website for Google, and now both www. and http:// give the same results indicatin开发者_如何学编程g that Google is considering a duplicate content. I want only http://, and

I am trying to optimize my website for Google, and now both www. and http:// give the same results indicatin开发者_如何学编程g that Google is considering a duplicate content. I want only http://, and www. to be redirected.

Thanks.


Google can usually figure this stuff out for itself but if you need to give it a hint you can use Googles 'webmaster tools'. Also you should generally use 301 (Permanent) rather than 302 for this.


If you are using Apache, in your .htaccess or in an equivalent place:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.example.com
    RewriteRule (.*) http://example.com/$1 [R=301,L]
</IfModule>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号