基本网址-如何调用首页链接 [英] Base URL - How to call the home link

查看:74
本文介绍了基本网址-如何调用首页链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的基本网址的示例

Here an example of my base URL

<base href="http://subdomain.domain.com/folder/" />

我想知道在尝试时如何为HOME链接调用该基本URL

I would like to know how to call that base URL for the HOME link when I try

<a href="/">Home</a>

它重定向到 http://subdomain.domain.com/,而不是在/folder/

It redirect to http://subdomain.domain.com/ and not in the /folder/

推荐答案

您需要的是应用程序/网站的虚拟目录名称.
这是一个服务器变量,不可能仅通过HTML来获取,您需要一些服务器端组件,例如PHP或ASP.NET.

What you need is the virtual directory name of your application/website.
This is a server variable, and it is not possible to get it in HTML alone, you need some server side component, like PHP or ASP.NET.

如果您在根目录中,则可以尝试相对链接.
因此,请尝试使用.表示来自此文件夹"

If you are in the root directory, you can try a relative link.
So try using a . to indicate "from this folder"

<a href="./">Home</a>


如果您的问题实际上涉及相反的方向,请执行以下操作:


Should your question actually concern the opposite direction, do this:

<a href="../">Home</a>


或使用绝对链接:


Or use an absolute link:

<a href="/folder">Home</a>

或使用规范链接

<a href="http://subdomain.domain.com/folder">Home</a>

这篇关于基本网址-如何调用首页链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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