html base and subdirectories

烂漫一生 提交于 2020-01-03 20:09:24

问题


In my html I have

<head>
 <base href="http://mydomain.com/dev/">
</head>

But my links all go to mydomain.com/ (without the "dev" subfolder). Why aren't my links pointing to the subfolder?

Thanks in advance.

EDIT: my link html is:

<div id="navigation">
<ul>
  <li><a href="/index.html">Home</a></li>
  <li><a href="/realestate.html">Real Estate</a></li>
  <li><a href="/property.html">Vehicles &amp; Boats</a></li>
  <li><a href="/location.html">Auction Locations</a></li>
  <li><a href="/auctionDetails.html">How the Auction Works</a></li>
  <li><a href="/contact.html" class="activeTab">Contact</a></li>
</ul>

Again, thanks.


回答1:


You are using root relative URIs (<a href="/foo">) instead of document relative URIs (<a href="foo">).

Resolution will start from http://example.com/dev/ but the / will cause the local part (everything after the domain/port number) to be dropped.

Do not start your links with a / character.



来源:https://stackoverflow.com/questions/11351944/html-base-and-subdirectories

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!