Aliasing Setup

Discussion in 'Mac OS X Server, Xserve, and Networking' started by keith1995, May 18, 2009.

  1. keith1995 macrumors newbie

    May 18, 2009
    I'm having some problems setting up a simple alias for a website.

    We have created a new site via server admin with settings such as this:

    domain name:
    host decription:

    Our DNS looks like this:

    @ A (Host)
    www A (Host)

    What we are trying to accomplish is that if you goto it should alias to however it is continuing to serve the site and the www only displays if you go directly to

    What am I doing wrong?
  2. SHIFTLife macrumors 6502

    Jul 24, 2008
    You can do this without using DNS to make it happen. I force the removal of www. on my website using .htaccess. In the root of your web server directory, there may be a hidden file called .htaccess. If it's not there, you can create it.

    Add the following lines to the .htaccess file to force the addition of www.:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^$
    RewriteRule ^(.*)$$1 [R=301]

    Replace both instances of your_domain with your domain name. Also, if you're not using .com as your TLD, make sure you change the TLD from .com to whatever you're using.

    EDIT: As an added benefit, this will force any search engines to use the www. version of your site to avoid duplicate content. This is beneficial for any "public" website.
  3. keith1995 thread starter macrumors newbie

    May 18, 2009
    Thanks for the reply.

    We'd like to use the alias feature in Server Admin and not rely on .htaccess for the www redirect if possible.

    What is odd is that the non-www aliasing is working fine for a few other sites we have setup already but not for a few we just setup yesterday. They appear to be using the same exact settings so I'm guessing something is amiss when it comes to DNS?
  4. ChrisA macrumors G4

    Jan 5, 2006
    Redondo Beach, California
    I think the way it works it that even if DNS point 100 different domain names to the same IP address Apache still "sees" the URL the browser sent. The term to google for is "virtual host"
    Or just read link below. I think what you want is two hosts one with and one without the WWW. Both using the same IP address and going to the same document directory.

Share This Page