: How to eliminate duplicate titles for a website URL using www.example.com and example.com My website uses both www.example.com and example.com. I recently tested for duplicate titles on the website
My website uses both example.com and example.com.
I recently tested for duplicate titles on the website and it seems that any title on a page at example.com and example.com is perceived as duplicate by search engines.
Does anyone know how I can use both the example.com and example.com without duplication?
More posts by @Gretchen104
2 Comments
Sorted by latest first Latest Oldest Best
Regarding the comment on your question, you only have one site which is served to your users with the two versions of the site (with www and without www).
Therefore, you need to 301 redirect one version to the others (as you wish). For this, you can use a .htaccess file if you use Apache as a web server (at the root of your site).
For exemple, here the code to redirect all www URLs to no-www URLs:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.com [NC]
RewriteRule (.*) example.com/ [QSA,R=301,L]
</IfModule>
Or the opposite (no-www to www):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ www.example.com/ [R=301,L]
</IfModule>
You have many ways to make it, if you want the users to access both versions with WWW and without, you can use canonical link from one version to the another one.
EX:
From the non WWW version
<link rel="canonical" href="https://www.example.com" />
If you don't want the users to access any of your pages for example the non WWW version, you can redirect all the pages without WWW to WWW using 301 redirect.
The last option is to add noindex in the for one of your pages
<meta name="robots" content="noindex,follow" >
It depends on your case, choose what fits your website.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.