Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X > Mac OS X Server, Xserve, and Networking

Reply
 
Thread Tools Search this Thread Display Modes
Old May 18, 2009, 11:39 PM   #1
keith1995
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
SHIFTLife
macrumors 6502
 
Join Date: Jul 2008
Location: Framingham, MA
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.
__________________
MacBook Air (2013) - i7, 8GB RAM, 512GB SSD
64GB iPhone 5s "Space Grey" 64GB iPad 3 Black (AT&T) 32GB iPad Mini Wifi Black

Twitter: bill_clark
SHIFTLife is offline   0 Reply With Quote
Old May 19, 2009, 10:23 AM   #3
keith1995
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
ChrisA
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.
http://httpd.apache.org/docs/1.3/vhosts/
ChrisA is offline   0 Reply With Quote

Reply
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Need to migrate, but already used setup assistant...did I totally screw up? mostlymac Mac OS X 10.7 Lion 3 Sep 2, 2011 11:24 PM
Need Advice for tech setup in new room njsa04playa Buying Tips and Advice 16 Aug 14, 2011 08:37 PM
Setup Assistant is Great! larryg1do OS X 0 Jul 17, 2011 10:55 PM
Stop Bluetooth Setup Assistant From Launching on Startup realph Mac Basics and Help 5 Mar 1, 2011 05:23 PM
Aliases, Upgrading .Mac & sub account setup Post MobileMe a1dipship OS X 0 Jun 12, 2008 04:07 AM


All times are GMT -5. The time now is 08:53 PM.

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

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