Jump to content


Photo

www resolve


  • Please log in to reply
2 replies to this topic

#1 TimW

TimW

    Advanced Member

  • Members
  • PipPipPip
  • 261 posts
  • Gender:Male
  • Location:West Country
  • Experience:Intermediate
  • Area of Expertise:Nothing

Posted 11 August 2017 - 01:38 PM

I was fiddling with htaccess today and not really knowing what I was doing. Am I right in thinking that requests for pages with/without www should all return pages from one, not the other, but it doesn't matter which?  so here for example I key in 
http://webdesignerforum.co.uk/

and my browser shows 
http://www.webdesignerforum.co.uk/

 

Hasn't google worked out that they are the same site and not duplicate content yet? Couldn't they just fix it at their end?



#2 Jack

Jack

    NaN

  • Moderators
  • PipPipPipPipPip
  • 3,184 posts
  • Gender:Male
  • Location:Jersey Channel Islands
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 11 August 2017 - 02:20 PM

It depends what your primary domain is set to, usually you just use a CNAME to redirect to the non-www or www version. I don't think you will get duplicate content issues if you have a redirect in place, Google should be smart enough to know that it's the same URL, but this won't work for subdomains. You can also inform Google of your primary domain through Webmaster Tools, or you can setup canonical URL's if you start seeing duplicate content warnings.

 

I would avoid using htaccess if it's avoidable, in this case it is, because you can manage the domain redirect through your DNS provider. Htaccess can cause sites to slow down because every request causes a look-up of the htaccess file, if I remember the process is something like this:

  • Look up the root htaccess file
  • Look for any other htaccess files in other directories
  • Batch the files together
  • Reconfigure the server with the new settings

Only then will you get a file sent down the wire, and it happens for every single request and can't be cached. If you've ever seen warnings about a lengthy time to first byte, this is sometimes the cause.



#3 Sumit_Singh

Sumit_Singh

    Forum Newcomer

  • Members
  • Pip
  • 17 posts
  • Gender:Male
  • Location:Delhi, India
  • Experience:Intermediate
  • Area of Expertise:SEO

Posted 07 October 2017 - 07:38 AM

I was fiddling with htaccess today and not really knowing what I was doing. Am I right in thinking that requests for pages with/without www should all return pages from one, not the other, but it doesn't matter which?  so here for example I key in 
http://webdesignerforum.co.uk/

and my browser shows 
http://www.webdesignerforum.co.uk/

 

Hasn't google worked out that they are the same site and not duplicate content yet? Couldn't they just fix it at their end?

 

Hi Tim

It is good practice to redirect your website on the one domain. And if your website having both www and non-www URLs then Google considered it as canonical URLs.

If you need to redirect all your URLs on the non-www, so, write this code into your .htaccess file

 

 RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.example.com [NC]


RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]

 

If you want www in your domain

 

 RewriteEngine on

RewriteCond %{HTTP_HOST} ^example.com [NC]


RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users