PDA

View Full Version : how to set www.domain.com when at domain.com?



reunionhall
01-01-2007, 03:33 PM
How do I configure my site change the URL to 'www.domain.com' when someone visits 'domain.com' (no 'www' subdomain)?

I heard of editing the .htaccess file, but what other ways, if easier, is there?

Why do I need this? My SSL Certificate is for 'www' subdomain, not the root, so the graphic doesn't show under the 'domain.com' and does under 'www.domain.com'.

TIA,
Robert

wildjokerdesign
01-01-2007, 04:15 PM
You can add the redirect that you have read of for .htaccess to your httpd.conf file but really it would be easier via .htaccess.

Here is a pretty good page that explains the .htaccess and gives a note about adding them to your httpd.conf http://corz.org/serv/tricks/htaccess2.php

bookish
01-05-2007, 07:27 PM
The quick answer: this works for me, put the following into a file called .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R,NC,L]