Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Anyone can help me out with an .htaccess I'm trying to create?

I want to redirect to

Any URL from (with or without www and under http or https) will all be redirected to

Some examples:

Many thanks!

share|improve this question
up vote 1 down vote accepted
RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteRule (.*) [R=301]
share|improve this answer
Remove the $1 and it'll work like the examples. – toppledwagon Feb 25 '10 at 1:07

Even though I'm not an expert, I have created functional redirects using .htaccess. Anyway, I think you'll need a redirect (from .com to .ca) in the root folder of the .com version like so

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)$1 [R=301,L]

In my opinion, the previously posted suggestion by Jeff Clark would rewrite non-www urls to www-included urls of the .ca version and only works in the root folder where the .ca version is located.

In addition, specifying 301 ensures that the search engines transfer any merit to the new domain as well.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.