2015-10-18 43 views
2

我想隱藏我的gitweb背後的實例逆向代理。因此,我將我的基本網址設置爲/gitweb,但一些網址仍然被破壞。爲什麼這被解釋爲絕對網址?

在調試問題時,我發現下面的樣式表從/gitweb.css而不是/gitweb/gitweb.css加載。

<base href="/gitweb" /> 
<link rel="stylesheet" type="text/css" href="gitweb.css"/> 

我發現a fix對於該問題的說,這些鏈接被解釋爲絕對URL。不幸的是我沒有使用Apache--這是在修復中使用的。

無論如何。我只是想知道爲什麼href="gitweb.css"不使用base href

+1

嘗試向路徑末尾添加斜槓 - '' – Vucko

回答

3

他確實,但缺少的斜槓使瀏覽器認爲「gitweb」是一個頁面,只使用「/」。這與基地相同。

參見:https://stackoverflow.com/a/1889957/4516689

還是在規範的例子:http://www.w3.org/TR/html5/document-metadata#the-base-element

<!DOCTYPE html> 
<html> 
    <head> 
     <title>This is an example for the &lt;base&gt; element</title> 
     <base href="http://www.example.com/news/index.html"> 
    </head> 
    <body> 
     <p>Visit the <a href="archives.html">archives</a>.</p> 
    </body> 
</html> 

在上面的例子中的鏈接將 「http://www.example.com/news/archives.html」 的鏈接。

+0

Makese有意義且有效。看起來像'gitweb.cgi'中的一個bug。 – Brettetete

相關問題