[英]Apache multiple DocumentRoot
How can I have the following setup in apache? 如何在apache中进行以下设置?
http://server/ABC/*
should be served by /var/www/ABC/*
http://server/ABC/*
应由/var/www/ABC/*
http://server/PQR/*
should be served by /var/www/PQR/*
http://server/PQR/*
应由/var/www/PQR/*
Every other request should be served by /var/www/Others/index.php
(a single file). 每个其他请求应由
/var/www/Others/index.php
(单个文件)提供。
Thanks, 谢谢,
JP J.P
Use Alias: 使用别名:
Alias /ABC/ /var/www/ABC/
Alias /PQR/ /var/www/PQR/
Leave the document root pointing to /var/www/Others/index.php. 保留文档根目录为/var/www/Others/index.php。 It could do the trick.
它可以做到这一点。 :)
:)
You can do this with mod_alias, which is part of the apache distribution. 您可以使用mod_alias执行此操作,mod_alias是apache分发的一部分。
http://httpd.apache.org/docs/current/mod/mod_alias.html http://httpd.apache.org/docs/current/mod/mod_alias.html
for serving everything else with the single file you would use mod_rewrite. 使用mod_rewrite来处理单个文件的所有其他内容。 This has many features and depending on your needs you might need to tweak that.. but something like this should work:
这有很多功能,根据您的需要,您可能需要调整..但这样的事情应该有效:
RewriteEngine on
RewriteRule ^(.*)$ /index.php?path=$1 [L]
you would put that in a .htaccess file in the document root. 你会把它放在文件根目录中的.htaccess文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.