html基本目录和子目录 [英] html base and subdirectories

查看:140
本文介绍了html基本目录和子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的html中有

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

但是我的所有链接都转到mydomain.com/(没有"dev"子文件夹).为什么我的链接没有指向子文件夹?

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

谢谢.

我的html链接是:

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>

再次感谢.

推荐答案

您正在使用根目录相对URI(<a href="/foo">),而不是文档相对URI(<a href="foo">).

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

分辨率将从http://example.com/dev/开始,但是/将导致丢弃本地部分(域/端口号之后的所有内容).

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

请勿以/字符开头链接.

这篇关于html基本目录和子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆