Help - Search - Members - Calendar
Full Version: domain.com to www.domain.com
The Planet Forums > Control Panels > Plesk
alx
hi all

I want users that enter into domain.com to be redirected to www.domain.com

What is a good approach to this? Play with the DNS settings or create a new domain entry that will simply redirect?

TIA
Alex
Squire
Simply set up an .htaccess for the domain Alex. Leave your vhost.conf exactly the way it is.

CODE
RewriteEngine on

Options +FollowSymlinks

RewriteCond %{HTTP_HOST} !^www.domain.com [NC]

RewriteRule ^(.*)$ [url="http://www.domain.com/$1"]http://www.domain.com/$1[/url] [R=permanent,L]


The above will also redirect any aliased/parked domains you have over to the real one. Works great for the search engines too.
alx
well... Squire.. thanks for the 32472397294898034th time! icon_smile.gif
cory_howell
I assume this will work regardless of the server control panel, correct?

Can someone please confirm?
Squire
Yup, it'll work on any *nix server where mod_rewrite is enabled.

IIS is another story.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.