Results 1 to 3 of 3

Thread: Virtual Host Problem

  1. #1
    Join Date
    Apr 2010
    Beans
    9

    Virtual Host Problem

    This is what I'm attempting to achieve:
    example.com > site
    www.example.com > site

    I've created the site as a virtual host:
    /etc/apache2/sites-available/example
    Code:
    <VirtualHost *:80>
            ServerAdmin me@example.com
            ServerName example.com
            ServerAlias *.example.org.uk
            DocumentRoot /home/me/Sites/example/www
            <Directory /home/me/Sites/example/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>
    Visitting the sites shows:
    http://example.com/ > Server page
    http://www.example.com/ > Example page

    Any suggestions please?

  2. #2
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,382
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Virtual Host Problem

    Aliases can be a space separated list.

    *.example.org.uk will not accept www.example.com requests.

    You line should be something like

    Code:
    ServerAlias *.example.org.uk *.example.com *.example.org *.example.uk
    I have never used the wild card "*", but I'm guessing it should work.

    I usually just list out the actual subdomains, since I may need additional subdomains for other sites.

    like
    Code:
    ServerAlias www.example.org.uk www.example.com
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  3. #3
    Join Date
    Apr 2010
    Beans
    9

    Re: Virtual Host Problem

    It worked! Thanks!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •