簡體   English   中英

Apache多個DocumentRoot

[英]Apache multiple DocumentRoot

如何在apache中進行以下設置?

http://server/ABC/*應由/var/www/ABC/*

http://server/PQR/*應由/var/www/PQR/*

每個其他請求應由/var/www/Others/index.php (單個文件)提供。

謝謝,

J.P

使用別名:

Alias /ABC/ /var/www/ABC/
Alias /PQR/ /var/www/PQR/

保留文檔根目錄為/var/www/Others/index.php。 它可以做到這一點。 :)

您可以使用mod_alias執行此操作,mod_alias是apache分發的一部分。

http://httpd.apache.org/docs/current/mod/mod_alias.html

使用mod_rewrite來處理單個文件的所有其他內容。 這有很多功能,根據您的需要,您可能需要調整..但這樣的事情應該有效:

RewriteEngine on
RewriteRule ^(.*)$ /index.php?path=$1 [L]

你會把它放在文件根目錄中的.htaccess文件中。

暫無
暫無

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

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