SEO规范网址(希腊字符) [英] SEO Canonical URL in Greek characters

查看:40
本文介绍了SEO规范网址(希腊字符)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含希腊字母的URL

I have a URL which including Greek letters

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

我正在使用 $ _ SERVER ['REQUEST_URI'] 像这样在我的页面标题中插入规范链接的值

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

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

问题是,当我查看页面源代码时,URL会显示类似 ... CE%B3%CE%B3%CE%B5%CE%BB ...这样的字符,但是当点击它,它会显示应有的链接

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?

推荐答案

不,这是正确的行为.网址中的所有字符都可以使用其可读格式或编码形式显示在页面源中,这些形式可以使用相关字符集的表进行转换.单击链接后,编码值将发送到服务器,服务器将其转换回其可读格式.

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.

常见的做法是对可能导致url出现问题的字符进行编码-空格是常见示例(%20),请参见Ascii表.%xx语法指的是字符的等效十六进制值.

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.

将HTML发送到浏览器时,请确保服务器指定的字符集与您的HTML匹配.搜索引擎还将寻找它来正确解码HTML.正确的方法是通过HTTP响应标头.在PHP中,这些是通过标题设置的:

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

这篇关于SEO规范网址(希腊字符)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆