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]

About the Author...

Jennifer Zelazny

My name is Jennifer Zelazny and this site is a collection of my random thoughts and opinions. I am Penn Stater, WordPress developer, and a modern day explorer. I love exploring data, trends, and things that make the world a better place and sharing them here.

Leave a Reply

Your email address will not be published.
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*