redirecting domain.com to www.domain.com.

So you have a web server and one/some domain names. You want to have all requests to domain.com to go to www.domain.com. most companies have this redirect in place (Apple is an example). I was stumped when I first set out to do this…so here is what I learned from our friends on the Apache mailing list.

ServerName www.domain.com
ServerAlias domain.com
Redirect permanent / http://www.domain.com/

ServerName www.domain.com
ServerAdmin [email protected]
DocumentRoot /Volumes/www/domain.com/documents


This set up in Apache will then redirect all domain.com requests to www.domain.com.
You cannot beat mailing lists’ support!
[tags]apache, vhosts, redirect[/tags]

serving apache on a local (not 127.0.0.1 address).

If you ever need to serve a web site for, let’s say a presentation, on a local address and need to connect to another computer…perhaps your database/ Web Objects server locally as well, and you are running Mac OS X…then I have some information for you.

  1. If you want to serve the web site on 10.0.0.2 and have your other server on 10.0.0.3, open the terminal and type in: sudo ifconfig en0 10.0.0.2. This will change the IP address. (changing the IP address in the network control panel was not enough)
  2. Next, edit the apache conf file: sudo pico /etc/httpd/httpd.conf and add Listen 10.0.0.2:80 and then restart apache

Now you can serve 10.0.0.2 on your local machine and connect to a computer on your local network. (connected by an ethernet cable)