你需要什么叫VirtualHost使www.example1.com和www.exaplme2.com点每到一个不同的文件夹中的文件系统。
如果你还希望有在URI不同的路径服务的主要内容,您有不同的选择:
物理上创建文件夹并做没有进一步的变化
物理创建链接(指向主虚拟主机根文件夹的名称库)到该文件夹并使用虚拟主机的FollowSymLinks选项
使用Alias指令在虚拟主机
Alias /gallery/
使用mod_rewrite
RewriteRule /gallery/(.*) /$1 [QSA]
最简单的(CodeIgniter的允许)会选择1或2
从虚拟主机文件摘录:
Running several name-based web sites on a single IP address.
Your server has a single IP address, and multiple aliases (CNAMES)
point to this machine in DNS. You want to run a web server for
www.example.com and www.example.org on this machine.
Note
Creating virtual host configurations on your Apache server does
not magically cause DNS entries to be created for those host
names. You must have the names in DNS, resolving to your IP
address, or nobody else will be able to see your web site.
You can put entries in your hosts file for local testing,
but that will work only from the machine with those hosts
entries.
Server configuration
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example.org
# Other directives here
</VirtualHost>
The asterisks match all addresses, so the main server serves no requests.
Due to the fact that www.example.com is first in the configuration file,
it has the highest priority and can be seen as the default or primary
server. That means that if a request is received that does not match
one of the specified ServerName directives, it will be served by this
first VirtualHost.
@ lrussell810:请不要在编辑后追加“Thanks in Advance”。它被视为混乱http://meta.stackexchange.com/questions/97136/suggested-edits-add-thanks-in-advance – naveen 2012-01-01 16:15:19