I cannot figure out the solution for a client. He has a site on name1.name2.com and want the domain including all the internal pages to be redirected to www.name2.com. I told him to put the following in the .htaccess: RewriteEngine On RewriteCond %{HTTP_HOST} !^name1.name2.com$ [NC] RewriteRule ^(.*)$ http://www.name2.com/ [R=301,L] He tried it but gets the following message: What do i do? I pay $15 to the one that solves it, thanks!
RewriteCond %{HTTP_HOST} ^name1.name2.com RewriteRule (.*) http://www.name2.com/$1 [R=301,L] or RewriteCond %{HTTP_HOST} name1.name2.com RewriteRule (.*) http://www.name2.com/$1 [R=301,L] Or try adding Options +FollowSymLinks to the top of the htaccess.
Thanks! But this line: RewriteRule (.*) http://www.name2.com/$1 [R=301,L] Is the $1 not redirecting let's from: name1.name2.com/name-of-a-file.html to www.name2.com/name-of-a-file.html He doesn't want that, but have all going to the www.name2.com.
not sure jim, but did you try: your condition was saying !^name1.name2.com$ i.e. the http host is not that subdomain RewriteEngine on RewriteCond %{HTTP_HOST} ^name1\.name2\.com RewriteRule ^(.*)$ http://www.name2.com/$1 [R=301,L]
I have sent 4 versions to the client to test. Let's see tomorrow if it works for him. I'll let you know. Thanks a lot.