Believe that a lot of webmaster friends have such problems appear. That is, the domain name with the WWW prefix and the top-level domain name without the WWW prefix are different. This problem is mainly due to the search engine for the top-level domain name and two-level domain name weight difference caused.
There is no doubt that the only domain name can bring you more benefits. Whether it is with the WWW or not with www. Because, so whether the user or search engine will remember your site's unique domain name. Nor will it cause a diversion of weights.
The following days tell you how to force a user or search engine to redirect to a unique domain name in. htaccess.
Copy Code code as follows:
#强制重定向到www
Rewriteengine on
Rewritecond%{http_host} ^jb51.net/[NC]
Rewriterule ^ (. *) $ http://www.jb51.net/$1 [l,r=301]
#强制重定向到不带www的顶级域名
Rewriteengine on
Rewritecond%{http_host}!^jb51.net/$ [NC]
Rewriterule ^ (. *) $ http://jb51.net/$1 [l,r=301]