Mobile app version of vmapp.org
Login or Join
Phylliss660

: Accented characters representation in the URL We have support for various languages in our website, including Spanish, French and Swedish. For now, the links in the site are NOT encoded before

@Phylliss660

Posted in: #Seo #Url

We have support for various languages in our website, including Spanish, French and Swedish.

For now, the links in the site are NOT encoded before sent to the browser, sending the real accented chars (if such exists, i.e. href="www.(dot)example(dot)com/héllo.html") and not their HEX representation.

This works & looks good on all browsers, including Chrome, FF and IE.

However, we care great deal about SEO.

We got this tip that encoding the links before sending them to the browser (so instead of linking to www.example.com/héllo, we will link to www.example.com/h%E9llo) will improve the way search engines will 'understand' the links and the keywords in the URL.

This involves some work at our side, so we wanted to know if there's truth in that tip, but couldn't find anything addressing this issue.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Phylliss660

1 Comments

Sorted by latest first Latest Oldest Best

 

@Kevin317

According to Google:


Yes, we can generally keep up with UTF-8 encoded URLs and we’ll
generally show them to users in our search results (but link to your
server with the URLs properly escaped). I would recommend that you
also use escaped URLs in your links, to make sure that your site is
compatible with older browsers that don’t understand straight UTF-8
URLs.


So encoding your URLs seems like it would be search engine friendly. But your best bet may be to just remove those special characters and replace them with the "non-special" alternatives. This StackOverflow answer shows some awesome code for doing that:


Try these functions:

<?php
function Slug($string, $slug = '-', $extra = null)
{
return strtolower(trim(preg_replace('~[^0-9a-z' . preg_quote($extra, '~') . ']+~i', $slug, Unaccent($string)), $slug));
}

function Unaccent($string)
{
return html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '', htmlentities($string, ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8');
}
?>


And use it like this:

<?php
echo Slug('Iñtërnâtiônàlizætiøn of Glaño'); // internationalizaetion-of-glano
?>


You can embed the Unaccent() code into the Slug() function if you
wish to have only one function.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme