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 http://www.example.com/héllo, we will link to http://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.

  • This question might be relevant. From info there, I get the feeling that when you type (or click on a link with) an unencoded URL, the browser will encode it into an ASCII URL before sending it to the server--which would make both URLs you wrote the same. But I'll have to test this out later as I'm not too sure. Commented Dec 9, 2011 at 4:36

1 Answer 1


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:

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', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8');

And use it like this:

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.

  • Thank you. Though it is simple to strip those special chars, we would like to keep them. The thread you linked to was a big help.
    – Dan
    Commented Dec 11, 2011 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.