I have recently moved a site to a new domain, and at the old domain, I created a .htaccess file that includes one line of code:
RedirectMatch 301 ^/(.*) http://newdomain.com/$1
The goal, of course, is to set 1:1 redirects for the entire site for anyone trying to access old links to the site.
This works perfectly unless the user includes "www." when they enter a URL for the old domain. In that case, they are not redirected.
I'm sure this has something to do with my ^/
, but I'm not sure what, as I did not think you could specify any rules regarding anything preceding the initial /
following the domain.
Does anyone know why this does not work when the user types in "www." as part of the URL on the old domain? And can you please tell me what I can do to fix this and make it redirect properly as it does otherwise?
Thank you for your help.
Edit: I was mistaken. The problem is when the person on this one particular computer includes "www."--not "http://" as I originally thought. Sorry for the oversight.
www
hostname. A separateVirtualHost
directive for example?