I'm trying to write a rule to permanently redirect a domain name to another domain name
RewriteCond %{HTTP_HOST} ^www.companyname1.com$
RewriteRule ^(.*)$ http://www.companyname2.com/$1 [R=301,L]
This only works if the user remembers to enter www, if the user does not enter www in the URL, the page loads, but the links to the image are broken.
Does anyone know how to configure the above rule to work with and without www?
I am using LAMP configuration, apache 2 on redhat.
source
share