Works for me. I'm running v2.4.16. What version of Apache HTTPD are you
running? According to the docs the NameVirtualHost "directive currently has
no effect." And the default behavior changed with v2.3.11. So I'm wondering
if you're running v2.2.*.

If you issue a "host example.com 8.8.8.8" command on a UNIX like system
does it report "example.com has address <myIP>"?

Also, when you say it "does not work and gets into a redirect loop"  how
did you determine that? Did you do a controlled test with a CLI tool like
curl with verbose (-v) output enabled and observe that you received a HTTP
301 redirect? Or did something else occur?

What does the Apache HTTPD access and error logs show? Setting "LogLevel
debug" might be necessary to get messages relevant to this problem.

On Mon, Aug 31, 2015 at 6:01 PM, Warren Bell <warrenbe...@gmail.com> wrote:

> I have 3 virtual hosts set up like this:
>
> <VirtualHost *:80>
>   ServerName www.example.com
>   ServerAlias example.com
>   DocumentRoot /var/www/html/example
>   ErrorLog /var/www/html/example/error.log
>   CustomLog /var/www/html/example/requests.log combined
> </VirtualHost>
>
> <VirtualHost *:80>
>   ServerName www.site1.example.com
>   ServerAlias site1.example.com
>   DocumentRoot /var/www/html/site1
>   ErrorLog /var/www/html/site1/error.log
>   CustomLog /var/www/html/site1/requests.log combined
> </VirtualHost>
>
> <VirtualHost *:80>
>   ServerName www.site2.example.com
>   ServerAlias site2.example.com
>   DocumentRoot /var/www/html/site2
>   ErrorLog /var/www/html/site2/error.log
>   CustomLog /var/www/html/site2/requests.log combined
> </VirtualHost>
>
> httpd.conf has the following uncommented:
>
> NameVirtualHost *:80
>
> and the following commented
>
> #ServerName www.example.com:80
>
> My DNS has A records
>
> example.com -> myIP
> *.example.com -> myIP
>
> myIP is the same for both records.
>
> site1.example.com works fine and goes to the correct site.
>
> site2.example.com <http://site1.example.com> works fine and goes to the
> correct site.
>
> example.com does not work and gets into a redirect loop.
>
> What do I need to configure to get example.com to work ?
>
> Thanks,
>
> Warren Bell
>



-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Reply via email to