Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Apache 2.2.3 running with a lot of virtual hosts (boiled down to 3 Zope instances), configured in separate files. Works quite well, with one exception: The redirection of mydomain.net to www.mydomain.com works, while www.mydomain.net to www.mydomain.com doesn't work.

Currently the configuration file for these two looks like this:

<VirtualHost *:80>
  ServerAdmin admin@otherdomain.de
  ServerName mydomain.net
  Redirect permanent / http://www.mydomain.com/
</VirtualHost>
<VirtualHost *:80>
  ServerAdmin admin@otherdomain.de
  ServerName www.mydomain.net
  Redirect permanent / http://www.mydomain.com/
</VirtualHost>

I had a single vhost with ServerAliases before, and used a RedirectRule, which didn't work either.

/usr/sbin/apache2 -S now tells me:

     ...
     port 80 namevhost mydomain.net (/etc/apache2/common-file.conf:1)
     port 80 namevhost www.mydomain.net (/etc/apache2/common-file.conf:25)
Syntax OK

All vhosts have a :1 there, with the only exception of the non-working redirection. What do I make of this information; how can I debug this?

share|improve this question
    
It seems the :nn numbers simply specify line numbers ... –  Tobias Mar 9 '12 at 15:58

2 Answers 2

Try changing your config to this and see

<VirtualHost *:80>
  ServerAdmin admin@otherdomain.de   
  ServerName mydomain.net   
  ServerAlias www.mydomain.net   
  Redirect permanent / http://www.mydomain.com/ 
</VirtualHost>
share|improve this answer
    
Nope; sadly, this doesn't work. I had a ServerAlias before, and I tried it again just now; with the ServerAlias variant, the separate line is not present, and it silently won't work. –  Tobias Mar 9 '12 at 15:56
up vote 0 down vote accepted

I just had a closer look, and I found the cause: the very ServerAlias www.mydomain.net was present in two virtual hosts (a right one, and the other). Removing the wrong entry solved the problem.

Thus, Apache doesn't seem to care about such collisions; you can't rely on the virtual hosts dump running w/no abnormalities detected.

share|improve this answer

Your Answer

 
discard

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.