Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

On single machine I've setuped two WordPress sites using aproperiate setus like below for each in apache sites I have separate configuration for each domain:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www_domain1

        <Directory /var/www_domain1/>
                Options FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all


        ErrorLog /var/log/apache2/error_domain1.log
        CustomLog /var/log/apache2/access_domain1.log combined

and .htaccess in a destination folder

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
order deny,allow

<Files wp-config.php>
  order allow,deny
  deny from all

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

and I have two probles:

  • is always redirected to
  • is redirected to (domain1 is alphabetically first, I think, but still this not what I want)
share|improve this question

2 Answers 2

Redirection is not caused by setting the servername and alias but very much more like "UseCanonicalName On" .. it should be set to off.

And second issue, you should add "NameVirtualHost *" to the main configuration file (depends on platform/distro you are running). Put the * in there, not the ip address since you have * in your virtual host definitions too.

share|improve this answer

The "redirection" is caused by setting the servername to "" with an alias of "". This causes Apache to treat all references to "" as if they referred to "". If you don't want this behavior, don't create the alias.

It sounds like you may be missing a "NameVirtualHost" directive in your main httpd.conf file to tell Apache to use name-based virtual hosts - which would explain why requests for both virtual hosts are directed to the first virtual host configured.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.