Why does a leading slash cause relative URLs in li

2019-07-27 13:04发布

On my page http://example.com/games/games/ipad.html I have links such as:

<a href="/../2010/junee2010/44/Grand Theft Auto Chinatown Wars HD.html">

This should resolve to the URL

http://example.com/games/2010/junee2010/44/Grand%20Theft%20Auto%20Chinatown%20Wars%20HD.html

but the "/games" is missing from the URL path when the link is followed. Instead, the link resolves to:

http://example.com/2010/junee2010/44/Grand%20Theft%20Auto%20Chinatown%20Wars%20HD.html

I try moving the page with the links to http://sitename/games/games/games/ipad.html, but it didn't change the URLs of the links. Using jQuery to remove the leading "/" from the href fixes the link URLs, but this is a overly complex solution.

标签: html url
1条回答
祖国的老花朵
2楼-- · 2019-07-27 13:54

Remove the slash at the beginning:

<a href="../2010/junee2010/44/Grand Theft Auto Chinatown Wars HD.html">link</a>
查看更多
登录 后发表回答