
我的應用程式根目錄:/public/index.php /public/front/index.html
我想要mydomain.com/api服務於/public/index.php,我的前端即靜態站點mydomain.com/從/public/front/index.html。
我嘗試過使用代理人和地點文檔根目錄為 /民眾/但未能在 Apache2 中提供結果。
需要一個正確的方法。 (已經使用一個簡單的conf讓nginx來做同樣的事情)
答案1
您通常使用Alias
指令將特定 URL 路徑對應到檔案系統上的位置,無論它們相對於指定 DocumentRoot 的位置為何。
DocumentRoot /public/front
Alias /api/ /public/
請注意,執行上述操作也會暴露您的前端,http://example.com/api/front/
但這是您選擇的奇怪目錄佈局的不幸結果...