SEO Canonical URL in Greek characters

- 1 answer

Ad

I have a URL which including Greek letters

http://www.mydomanain.com/gr/τιτλος-σελιδας/20/

I am using $_SERVER['REQUEST_URI'] to insert value to canonical link in my page head like this

<link rel="canonical" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="http://www.mydomanain.com<?php echo $_SERVER['REQUEST_URI']; ?>" />

The problem is when I am viewing the page source the URL is displayed with characters like ...CE%B3%CE%B3%CE%B5%CE%BB...but when clicking on it, its display the link as it should be

Is this will caused any penalty from search engines?

Ad

Answer

Ad

No, this is the correct behaviour. All characters in urls can be present in the page source using their human readable form or in encoded form which can be translated back using tables for the relevant character set. When the link is clicked, the encoded value is sent to the server which translates it back to it's human readable form.

It is common to encode characters that may cause issues in urls - spaces being a common example (%20) see Ascii tables. The %xx syntax refers to the equivalent HEX value of the character.

Search engines will be aware of this and interpret the characters correctly.

When sending the HTML to the browser, ensure that the character set specified by the server matches your HTML. Search engines will also look for this to correctly decode the HTML. The correct way to do this is via HTTP response headers. In PHP these are set with header:

header('Content-Type: text/html; charset=utf-8'); 
    // Change utf-8 to a different encoding if used
Ad
source: stackoverflow.com
Ad