网址和超链接中的哈希标记

时间:2015-04-02 13:26:59

标签: url hyperlink hashtag

我创建了一个文件的超链接。文件名包含主题标签,作为分隔信息的手段。

<a href="upload/1427853638#0#file#A101.pdf"><div style="height:100%;width:100%">.</div></a>

翻译为......

http://localhost/dir/upload/1427853638#0#file#A101.pdf

这是URL中的“合法”名称吗?我收到“找不到文件”错误

The requested URL /dir/upload/1427853638 was not found on this server.

所以,显然#在URL中有另一种含义(我现在理解,它是一个位置哈希属性)。有没有办法让它工作,或者我需要在文件名中使用#以外的其他字符?

1 个答案:

答案 0 :(得分:1)

由于#是URL语义中的特殊字符(它用于在HTML页面中提供内部锚点),因此应将其编码为%23

您的网址应为:http://localhost/dir/upload/1427853638%230%23file%23A101.pdf

注意:您可以在此处找到在线网址编码器:http://meyerweb.com/eric/tools/dencoder/

相关问题