我怎样才能在HTML中引用相对的子域? [英] How can I refer to a relative subdomain in HTML?

查看:81
本文介绍了我怎样才能在HTML中引用相对的子域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个可以被多个域访问的网站,例如 domain1.com domain2.com



如果我有一个相对的链接,比如 href =/ wiki,那么无论我通过哪个域名访问该网站,该链接都会将我带到正确的位置。



可以说我想用 wiki.domain1.com wiki.domain2 .com ,是否有某种方式可以使这个相对于域名的链接?



如果没有,是否有一个优雅的方式当多个域指向同一个服务器时,如何处理上面的维基链接等链接? 解决方案

你必须给整个域。要从 domain1.com 链接到 wiki.domain1.com ,链接必须看起来像 href =http://wiki.domain1.com


Let's say I have a website which is accessed by multiple domains, e.g. domain1.com and domain2.com.

If I have a relative link, such as href="/wiki", then no matter what domain name I access the website by, that link will take me to the correct place.

Lets say instead I wanted to use wiki.domain1.com and wiki.domain2.com, is there some way I can make a link to this relative to the domain name?

If not, is there an elegant way to handle a link such as the wiki link above when multiple domains point to the same server?

解决方案

No. You'll have to give the whole domain. To link from domain1.com to wiki.domain1.com, the link has to look like href="http://wiki.domain1.com".

这篇关于我怎样才能在HTML中引用相对的子域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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