Our website is targeting several languages and countries. We make the choice to use subdomain to manage our URLs. We want to avoid to create duplicate content and canonical issues.The content for www. and en. is identical but we plan to adapt the content for en. (in order to target UK).
For main domain, google is understanding:
<link href="https://www.example.com/" hreflang="en" rel="canonical" data-trid="15">
<link href="https://example.com/" hreflang="x-default" rel="alternate" data-trid="16">
<link href="https://example.com/" hreflang="en" rel="alternate" data-trid="17">
<link href="https://en.example.com/" hreflang="en-gb" rel="alternate" data-trid="18">
<link href="https://fr.example.com/" hreflang="fr" rel="alternate" data-trid="19">
<link href="https://de.example.com/" hreflang="de" rel="alternate" data-trid="20">
For english subdomain:
<link href="https://en.example.com/" hreflang="en-gb" rel="canonical">
<link href="https://example.com/" hreflang="x-default" rel="alternate">
<link href="https://example.com/" hreflang="en" rel="alternate">
<link href="https://en.example.com/" hreflang="en-gb" rel="alternate">
<link href="https://fr.example.com/" hreflang="fr" rel="alternate">
<link href="https://de.example.com/" hreflang="de" rel="alternate">
What is the best practice to avoid any canonical & duplicate content issues?
Thanks for your help!
Common Mistakes
Important: Make sure that your provided hreflang value is actually valid. Take special care in regard to the two most common mistakes:
Missing confirmation links: If page A links to page B, page B must link back to page A. If this is not the case for all pages that use hreflang annotations, those annotations may be ignored or not interpreted correctly.
Incorrect language codes: Make sure that all language codes you use identify the language (in ISO 639-1 format) and optionally the region (in ISO 3166-1 Alpha 2 format) of an alternate URL. Specifying the region alone is not valid. Via / Read:
https://support.google.com/webmasters/answer/189077?hl=en
The best way to avoid duplicates is to create a unique content for each version, if you can't add content now you have to block these pages or sub-domains by robots.txt or by adding a canonical link to the original page which is en.example.com in your case.
when you have content for each version, remove all these changes and make google able to index them.
Related
I am recently having an increased number of "hreflang no return tags" error on the Google webmaster console and I cannot figure out what I am missing. My site is www.example.com and it can be accessed in different languages as www.example.com/#!/xx, where xx is one of the following options: it, ro, ru, pt, en, es, fr.
My code snippet looks like:
<link view-head rel="alternate" hreflang="x-default" href="{{domain_absolute}}#!/{{mainVars.currentLanguage}}/--about-us" />
<link view-head rel="alternate" hreflang="es" href="{{domain_absolute}}#!/es/--about-us" />
<link view-head rel="alternate" hreflang="pt" href="{{domain_absolute}}#!/pt/--about-us" />
<link view-head rel="alternate" hreflang="ro" href="{{domain_absolute}}#!/ro/--about-us" />
<link view-head rel="alternate" hreflang="ru" href="{{domain_absolute}}#!/ru/--about-us" />
<link view-head rel="alternate" hreflang="en" href="{{domain_absolute}}#!/en/--about-us" />
<link view-head rel="alternate" hreflang="it" href="{{domain_absolute}}#!/it/--about-us" />
<link view-head rel="alternate" hreflang="fr" href="{{domain_absolute}}#!/fr/--about-us" />
And the errors I get from Google are the following:
Original URL : #!/en/some-document
Alternate URLs: http://www.example.com/?_escaped_fragment_=/en and http://www.example.com/?_escaped_fragment_=/en/some-document - no return tags
I get the same errors for all of the supported languages.
What am I doing wrong?
# is a special character. Everything in a URL after the # is ignored.
#! is a special case. If you use #! then Google treats it as a signal to convert it to a different URL for AJAX crawling. This "feature" is deprecated. And your URL structure tells me you are not using #! in this way anyway.
So bottomline: change your URLs so that you are not using #. Give all languages their own URL.
While deprecated, Google is understanding the #! and converting the URL to the escaped fragment version. Since Google is telling you they cannot find the return on the /?_escaped_fragment_ version of the URL this is telling me that your rewrite of the URL to respond to their request is missing the HREFLang Element.
View the source on http://www.example.com/?_escaped_fragment_=/en/some-document and if you don't see the HREFLang string you show in the screen capture that is your problem. Ensure you have it on both versions and YES you should cover it to include the escaped fragment version of the URL and that error will go away.
The alternative I use for sites with more than 5 country/language combinations is to use XML site maps and submit the excepted fragment version.
.htaccess file code
RewriteEngine On
RewriteRule ^book/([a-zA-Z0-9_-]+)$ book.php?isbn=$1
RewriteRule ^book/([a-zA-Z0-9_-]+)/$ book.php?isbn=$1
It works but the css files, images files, JS files linked with it doesn't work. The Page come without any css formatting. The url to my website is given below please help
Link to My Page using this
I want that an address which is like "www.booksiders.com/book.php?isbn=9780545010221" to appear like "www.booksiders.com/book/9780545010221"
and this is working but somehow the linked files are not working.
You have problem not with rewrite rules.
Change
<link rel="stylesheet" type="text/css" href="css/any.css" />
to
<link rel="stylesheet" type="text/css" href="/css/any.css" />
because browser think that he has to load book/css/any.css, but must load /css/any.css
I've found some conflicting information regarding SSL and links of external sources. In one web source, the writer says that all external resources should be explicitly made as https. His solution would be to use "//" (an https connection of the url would lead to an https connection of the resource) as in:
<link rel="stylesheet" type="text/css" media="all" href="//css/styles.css" />
On another page, I saw that as long as the external resource is coming from your domain, it won't be an issue. So for example,
<link rel="stylesheet" type="text/css" media="all" href="/css/styles.css" />
or
(more explicitly)
<link rel="stylesheet" type="text/css" media="all" href="https://www.mycoolwebsite.com/css/styles.css" />
would both work.
I've tested my https connection in Firefox using
<link rel="stylesheet" type="text/css" media="all" href="/css/styles.css" />
and it worked fine, but it also seems that SSL may not work on all browsers, so I'm not convinced that my 1 browser check is indicative of a solution that will work wherever SSL works.
Which would be the best approach for my external css/javascript files that reside on my own domain?
Which one is the best way to contruct a multi-language site if you want the most effective SEO?
Use a single domain?
www.domain.com/en
www.domain.com/de
www.domain.com/dk
Or use multiple domains, one for each language?
www.domain.com
www.domain.de
www.domain.dk
If you have multi-lingual content you should follow Google's new multi-lingual guidelines. Basically, you use subdomains for the different translations:
To explain how it works, let’s look at some example URLs:
http://www.example.com/ - contains the general homepage of a website, in Spanish
http://es-es.example.com/ - is the version for users in Spain, in Spanish
http://es-mx.example.com/ - is the version for users in Mexico, in Spanish
http://en.example.com/ - is the generic English language version
On all of these pages, we could use the following markup to specify language and optionally the region:
<link rel="alternate" hreflang="es" href="http://www.example.com/" />
<link rel="alternate" hreflang="es-ES" href="http://es-es.example.com/" />
<link rel="alternate" hreflang="es-MX" href="http://es-mx.example.com/" />
<link rel="alternate" hreflang="en" href="http://en.example.com/" />
If you specify a regional subtag, we’ll assume that you want to target that region.
Keep in mind that all of these annotations are to be used on a per-URL basis. You should take care to use the specific URL, not the homepage, for both of these link elements.
I'm making a project using iWebKit. I When I include the files, I don't want to have to keep linking back to the directory the framework is in like:
<link href="css/style.css" rel="stylesheet" media="screen" type="text/css">
<link href="../css/style.css" rel="stylesheet" media="screen" type="text/css">
<link href="../../css/style.css" rel="stylesheet" media="screen" type="text/css">
<link href="../../../css/style.css" rel="stylesheet" media="screen" type="text/css">
I want to be able to have the same directory in every other directory so localhost/css/style.css is the same as localhost/some/other/directory/css/style.css.
I am using Apache and want to know if there is a way to do this with .htaccess
Use absolute paths
<link href="/css/style.css" rel="stylesheet" media="screen" type="text/css">
Note the / in from of the path.
You can do this my using mod_rewrite
For this add the following to the .htaccess file in the root of your application
RewriteEngine On
RewriteRule ^.*/css/([^./]*)\.css$ /css/$1.css [L]
Here the Regular Expression ^.*/css/([^./]*)\.css$ matches any string with /css/any_name.css in the end, and rewrites the URL to point internally to css folder in the root. And [L] means it is the last rule to match if it matches. And $1 refers to the parenthesized portion of the Regular Expression that matches the URL, which is the name of the stylesheet
For more complex scenarios I would suggest you read up some more on the internet.