所以我在同一个IP上有两个不同的站点。基本上,我只想将流量从一个域定向到某个文件夹,然后从另一个域定向到不同的文件夹。我读了这页..。http://httpd.apache.org/docs/2.0/vhosts/examples.html,并将我的站点启用配置文件设置为这样,但我的第二个域只是将流量路由到我的原始站点。
所以..。域1: cdphoto.uni.cc域2: wtfdoidoatubc.uni.cc
我的配置文件看起来像this
谢谢你的建议!
发布于 2011-03-28 04:17:43
在这种情况下,最好使用控制面板并添加重定向,除非您打算将站点的主要部分用于某些用途。但如果不是这样,从主机控制面板中选择重定向规则将是最好也是最简单的选择。
发布于 2011-03-28 04:42:19
也许可以尝试使用DocumentRoots /var/www/site1和/var/www/site2?现在,第二个站点位于第一个站点的子文件夹中。如果您请求http://www.cdphoto.uni.cc/wtf,会发生什么?
发布于 2011-03-30 10:03:27
我会试一试,并确保您注意到我对第一个文档根所做的更改。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/cdp
ServerName www.cdphoto.uni.cc
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/cpd>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/www/trac
PythonOption TracUriRoot /trac
</Location>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/wtf
ServerName www.wtfshouldidoatubc.uni.cc
</VirtualHost>https://stackoverflow.com/questions/5452067
复制相似问题