Apache multiple DocumentRoot

前端 未结 2 819
無奈伤痛
無奈伤痛 2020-12-29 20:50

How can I have the following setup in apache?

http://server/ABC/* should be served by /var/www/ABC/*

http://server/P

2条回答
  •  执念已碎
    2020-12-29 21:27

    You can do this with mod_alias, which is part of the apache distribution.

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

    for serving everything else with the single file you would use 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.

提交回复
热议问题