Forum Moderators: phranque
[edited by: jdMorgan at 8:47 pm (utc) on May 19, 2010]
[edit reason] example.com & de-linked [/edit]
RewriteEngine On
#
# Externally redirect all requests for non-blank non-canonical hostnames
# to the canonical hostname, preserving the requested URL-path
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteEngine On
#
# Externally redirect all requests for non-blank non-canonical hostnames to the
# canonical hostname, preserving the requested http/https protocol and URL-path
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$
RewriteRule ^(.*)$ http%2://www.example.com/$1 [R=301,L]
I'd have to do it myself and know it's done correctly.
If your control panel is like most, and your canonical domain is "www.example.com", try the following URLs for your "home page"
Others that likely won't work (that is, they may not get redirected), but can only be tested with Telnet or similar tools