Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect WWW to non WWW, or the other way around? [closed]

Ive just ran an seo audit on my site and received this message...

Be sure that www.mysite.co.uk and myside.co.uk are not running in parallel.

Redirecting requests from a non-preferred hostname is important because search engines consider URLs with and without "www" as two different websites.

Once your preferred domain is set, use a 301 redirect for all traffic to your non-preferred domain.

Now my website works with both www. and without the www. so does this mean my sites running in parallel?

If so how do i address this? and shall i point my non www to the www or the other way around?

Im using PHP on a linux/apache server.

like image 832
Liam Avatar asked Jan 09 '13 20:01

Liam


People also ask

Should you redirect www to non-www?

Conclusion. People tend to leave the www out when typing a website's address. It might not cause significant issues since visitors will reach the same page, but it's best to redirect site visitors to its www version. This is because your site's performance and SEO might be affected if you keep using non-www domains.

Does changing www to non-www affect SEO?

Does it matter for SEO? In short, (directly) no. From an SEO perspective it doesn't make a difference whether you use WWW or not in front of your domain name. What's important is that you have a preferred version and redirect all others to that one.


2 Answers

Now my website works with both www. and without the www. so does this mean my sites running in parallel?

Pretty much. Running in parallel means that a visitor (human or search engine robot) can access same content with www and non-www version of the URL.

The recommended practice is to have both hostnames active but redirect all traffic of the non-preferred hostname to the preferred one using 301 redirect.

If so how do i address this?

For Apache, place these rules in the .htaccess file located in the wwwroot directory:

#########################
# redirect no-www to www
#########################

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+) [NC]
RewriteRule ^(.*) http://www.%1/$1 [R=301,NE,L]

-- or --

#########################
# redirect www to no-www
#########################

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^(.*) http://%1/$1 [R=301,NE,L]

and shall i point my non www to the www or the other way around?

There is no definite answer; both have their pros and cons. See Yes WWW to understand why having a www URL is good, and its competitor No WWW which simply says "www. is deprecated." without an explanation.

like image 167
Salman A Avatar answered Sep 22 '22 18:09

Salman A


Indeed, keep available www and no-www versions for a web site can be hasardous because it generates duplicate content between two versions of your web site. And Google doesn't like duplicate content, that's why it's good seo pratice to redirect www to no-www or the opposite.

With Apache Server, you can create .htaccess file (in root of your domain) and insert these lines to redirect (301 redirect) www to no-www:

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

You also can choose the opposite (redirect from no-www to www) if you prefer. No matter for seo if you choose one or other solution.

like image 34
Zistoloen Avatar answered Sep 23 '22 18:09

Zistoloen