English 中文(简体)
网站的重新定位
原标题:Website Redirection
  • 时间:2011-09-22 04:40:52
  •  标签:
  • html

Suppose that the user is currently located http://www.example.com/folder1/folder2/. I would like to be able redirect them to the home page at http://www.example.com/. The catch is, I don t know I m two folders deep and I don t know what the domain name is. To do this, what should the href be in a link? For example, href= ../../ would seem to work if I know a priori I m two folders deep, but in general I won t know that. I want a link that will always direct me right to the home page, regardless of how deep I am and regardless of the domain name of the site. How do I do this?

Thanks in advance!

最佳回答

采用根本的相互关系,从现场根基开始,并对外建。 在此情况下,你想直接走到底,因此,你的道路只能是<条码>/:

<a href="/">Home</a>
问题回答

“/”将直接针对网站的根基:

<a href="/">Home</a> <!-- http://site.com/ -->
<a href="/lol/abc.html">ABC</a> <!-- http://site.com/lol/abc.html -->

等等。

您可使用<代码>href=”/“来查找一个站点的根基。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签