Anyone can help me out with an .htaccess I'm trying to create?
I want to redirect foo.com to foo.ca.
Any URL from foo.com (with or without www and under http or https) will all be redirected to www.foo.ca.
Some examples:
- http://www.foo.com/ --> http://www.foo.ca/ (http + www)
- https://www.foo.com/ --> http://www.foo.ca/ (https + www)
- http://foo.com/bar/ --> http://www.foo.ca/ (http + some url)
- https://foo.com/bar/ --> http://www.foo.ca/ (https + some url)
- http://www.foo.com/bar/ --> http://www.foo.ca/ (http + www + some url)
- https://www.foo.com/bar --> http://www.foo.ca/ (https + www + some url)
Many thanks!
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
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.