Apache 安裝後預設文件根目錄位於 htdocs 資料夾(如 C:/wamp/bin/apache/Apache2.2.21/htdocs/)。實際開發常需指向專案自有目錄,避免汙染預設目錄或方便多專案切換。
conf/httpd.conf 設定檔DocumentRoot "(含雙引號),將雙引號內路徑改為目標目錄,例如:
DocumentRoot "D:/Apache"
<Directory ",將第一組雙引號內路徑同步修改:
<Directory "D:/Apache">
<Directory> 區塊的 Require all granted 設定/ 或雙反斜線 \\若需同時運行多個專案,建議改用 VirtualHost 設定獨立域名/端口對應不同目錄,而非頻繁修改主 DocumentRoot。