I've a domain domain.com
and made one sub domain 'forum.domain.com'. I'm using Apache2
and added one A record
to the dns records and made virtualNameServer
as:
<VirtualHost *:80>
ServerName forum.domain.com
DocumentRoot /var/www/vanilla
<Directory /var/www/vanilla>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
allow from all
</Directory>
ErrorLog "|/usr/sbin/rotatelogs /etc/httpd/logs/vanilla-error.%Y-%m-%d.log 86400"
CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/vanilla-access.%Y-%m-%d.log 86400" "%h %l %u %t %D \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
</VirtualHost>
In the sub-domain, I've installed Vanilla Forum Software
. But, now the problem is, whenever I go to http://domain.com
or http://www.domain.com
, it goes to http://forum.domain.com
. There is .htaccess
by default in forum.domain.com
:
# Original
# If you modify this file then change the above line to: # Modified
<IfModule mod_rewrite.c>
RewriteEngine On
# Certain hosts may require the following line.
# If vanilla is in a subfolder then you need to specify it after the /.
# (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
</IfModule>
Please help. Thanks in advance.
Best Answer
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
Using Name-based Virtual Hosts
Main host goes away
If you are adding virtual hosts to an existing web server, you must also create a block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host.