开发者

How to handle #(hash) character in SEO friendly url?

How do you bypass the default behaviour if #(hash) which is to go to a specific part of a page? The problem that I have is that the # character is a part of the SEO friendly url which is a title and the #(hash) is part of the content (i.e. like with C#). I can't retrieve the whole string and I only get the characters before the #.

Example:

www.domain.com/C#-programming-book

in this example I only get 'C' and not the '-programming-book' part. I am not using any javascript at the moment and would like to only use a PHP solution for this.

Before anyone suggests that I used url encoding, the criteria for the seo friendly url is that it should be human readable and easily remembered. So converting the hash to '%23'开发者_如何学C does not pass the criteria.

Is there no way around it?


# is part of the defined way URLs work which you can't change. The browser will strip off the # and any text after it before making a request. Once it gets the response it will then search the page for the element with the # name.

Do what most people do and change it to the word "sharp". i.e. "csharp"


# characters have special meaning in URLs have need to be encoded as %23 if they are to appear as data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜