Go Back   MacRumors Forums > Apple Systems and Services > OS X > Mac OS X Server, Xserve, and Networking

Thread Tools Search this Thread Display Modes
Old May 18, 2009, 11:39 PM   #1
macrumors newbie
Join Date: May 2009
Aliasing Setup

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: www.domain.com
host decription: domain.com
alias: domain.com

Our DNS looks like this:

@ A (Host) xxx.xxx.xxx.xx
www A (Host) xxx.xxx.xxx.xx

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

What am I doing wrong?
keith1995 is offline   0 Reply With Quote
Old May 19, 2009, 09:26 AM   #2
macrumors 6502
Join Date: Jul 2008
Send a message via AIM to SHIFTLife Send a message via Yahoo to SHIFTLife
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} !^www.your_domain.com$
RewriteRule ^(.*)$ http://www.your_domain.com/$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.
Twitter: bill_clark
SHIFTLife is offline   0 Reply With Quote
Old May 19, 2009, 10:23 AM   #3
Thread Starter
macrumors newbie
Join Date: May 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?
keith1995 is offline   0 Reply With Quote
Old May 19, 2009, 11:17 AM   #4
macrumors G4
Join Date: Jan 2006
Location: 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.
ChrisA is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > OS X > Mac OS X Server, Xserve, and Networking

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Font smoothing or anti-aliasing problems Doc69 OS X 0 Apr 28, 2014 04:34 PM
iOS 7.1 Multitask does anti-aliasing kwokaaron iOS 7 1 Mar 12, 2014 01:32 AM
monospace fonts without anti-aliasing for terminal uncleMonty OS X 1 Oct 1, 2013 10:26 AM
New Airport Extreme Setup - Wireless or Wired For Out-Of-Box Setup? crellion Mac Peripherals 4 Aug 16, 2013 12:41 PM
In for a sub-$400 hi-fi digital setup, opinion on proposed setup? Prodo123 Digital Audio 2 Jun 24, 2012 06:49 PM

Forum Jump

All times are GMT -5. The time now is 05:28 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC