pictures

redirecting domain.com to www.domain.com.

hr
hr Heading 2 Icon 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.

< virtualhost *:80 >
ServerName www.domain.com
ServerAlias domain.com
Redirect permanent / http://www.domain.com/
< /virtualhost >

< virtualhost *:80 >
ServerName www.domain.com
ServerAdmin webmaster@domain.com
DocumentRoot /Volumes/www/domain.com/documents
< /virtualhost >

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]


search

subscription information

Blog RSS

Comments RSS



Powered by FeedBlitz

blog categories

blog tags

most popular posts


blog archive

standards

Get Firefox!
XHTML
CSS