簡體   English   中英

關於 Apache 文檔根目錄的混淆

[英]Confusion regarding Apache document root

在我為公司工作的一個應用程序中,我遇到了一個奇怪的行為,或者這只是我的誤解,我希望我能得到一些澄清。 該應用程序由 Apache 提供服務,根目錄為: /company/client 對於我訪問的每個頁面,例如https://11.11.11.11/index.phtml ,它實際上將指向服務器中的文件/company/client/index.phtml等等。 In one of the modules of the application, it contains a move_uploaded_file php function, and the target directory is /images/example/, when the page is run, the app is trying to go to the absolute server root /images/example/ instead /company/client/images/example/的。

此外,由 window.open 打開的新窗口有一個帶有src='/images/exmaple/'的 img 標簽,這指向服務器根目錄而不是/company/client/images/example/ ,這是預期的嗎?

我錯過了什么,還是與 Apache 配置有關?

附加信息:

該應用程序在 conf 文件中用作虛擬主機,DocumentRoot 為“/company/client/”。

正在執行 window.open 和 php function 的頁面用作 ZA025E05161BB17CAB8BZ8Fhtmlany/client/77CAB8BZ8F0E 內部的 ZA025E05161BB17CAB8BZ8F0E

對不起,我錯了。

感謝大家特別是 Chris G 的幫助,問題是代碼錯誤地使用了 GET 變量,導致圖像名稱未通過。 我很困惑,因為有人通過相對於根文件夾移動圖像而在代碼中犯了錯誤,這是不正確的。 這讓我認為 PHP 也像客戶端一樣對待路徑,這是一個錯誤。 我猜我可以得出結論,web 服務器文檔根僅適用於所有客戶端,例如 url、JS、HTML?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM