我有我的網站www.example.com并且我在www.example.com/site有一個頁面。
如果我在該網站上創建這樣的鏈接,<a href="/something.html">button</a>那么它會將我重定向到www.example.com/something.html。
在不更改 href 鏈接的情況下是否有任何解決方案,因此它重定向到www.example.com/site/something.html?
我正在使用 apache2 來托管該站點。
謝謝
uj5u.com熱心網友回復:
<a href="/something.html">button</a>
您需要指定檔案夾,因此您可以執行以下操作:
<a href="site/something.html">button</a>
或者你可以這樣做:
<a href="https://www.example.com/site/something.html">button</a>
uj5u.com熱心網友回復:
假設site當您嘗試轉到something.html也在檔案夾中的檔案夾時您已經在檔案site夾中,您將使用
<a href="something.html">button</a>
/你的鏈接地址前面的斜杠是告訴瀏覽器去根目錄www.example.com然后找到something.html. 這就是為什么你最終得到www.example.com/something.html.
所以再次,只需使用<a href="something.html">button</a>.
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/364465.html
