开发者

Removing special chars from URL with .htaccess

I'm trying to use urls on my site like example.com/@lorem-开发者_Python百科ipsum-dolor instead of example.com/tag/lorem-ipsum-dolor form.

It's working on my local and remote servers, but if urls contains " : \ * | etc chars it's not working on local server (Win XP).

  1. Is there any solution?
  2. If not, then I think I need to remove that chars from url on local server. I googled for this a lot, but no result properly.

Any idea?


Those characters are not allowed in URLs. This really matters: Your URLs will fail validations and are likely to cause technical problems, because characters like @ and : are used elsewhere in a valid URL.

From RFC 2396 via this SO question:

Many URI include components consisting of or delimited by, certain special characters. These characters are called "reserved", since their usage within the URI component is limited to their reserved purpose. If the data for a URI component would conflict with the reserved purpose, then the conflicting data must be escaped before forming the URI.

  reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                "$" | ","
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜