: 301 Redirect not behaving like I am wanting it too. What is my mistake? 301 Wildcard. I don't think I am doing it right. Need domain1.com/keyword5 to go to domain2.com/keyword5. Instead it does
301 Wildcard. I don't think I am doing it right. Need domain1.com/keyword5 to go to domain2.com/keyword5. Instead it does this:
domain1.com/keyword5 goes to domain2.com (tld, root, not the keyword5 directory)
Here is my .htaccess:
RewriteCond %{HTTP_HOST} ^domain1.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain1.com$
RewriteRule ^(.*)$ "http://www.domain2.com/" [R=301,L]
PS: Can I do multiple domains on the same .htaccess? For example, I have 3 domains on the same public_html, can I 301 each of them like this?
More posts by @Sue5673885
1 Comments
Sorted by latest first Latest Oldest Best
Your .htaccess actually looks OK-ish to me, in that it should work, although it can be simplified:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?domain1.com$
RewriteRule ^(.*)$ www.domain2.com/ [R=301,L]
The RewriteRule substitution is a string, not a regex, so no need to escape everything. In fact you never need to escape forward slashes in .htaccess. No need for the double quotes either.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.