1

I have multiple domains and one htaccess for these. We split off some content from domain1.com to domain2.com and I need to redirect to the new page.

Redirect 301 /folder/page.html https://www.domain2.com/folder/page.html

resulted in a infinity loop ... i also tried this but its dont work:

RewriteCond %{HTTP_HOST} ^domain1.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain1.com$
RewriteRule ^/folder/page.html https://www.domain2.com/folder/page.html [R=301,L]

I also need to mention that not all pages from domain1 should redirect to domain2 but it would be ok if the whole folder is redirected

my knowledge of htaccess isnt that big hope you can help me!

1 Answer 1

1

Based on your shown samples, could you please try following. Please place this to the top of your htaccess file.

Also please make sure to clear your browser cache before testing your URLs.

RewriteEngine ON
RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com$ [NC]
RewriteRule ^folder/page\.html https://www.domain2.com/folder/page.html [R=301,NC,L]
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks man, that works out, espacially the hint with the top if my htaccess file, do you may have an explanation why the bottom of the file didnt workt out here? the normal Redirect 301 works out fine there and there is also a RewriteEngine ON
@codingbear, your welcome, why on the op I mentioned because other rules shouldn't come into picture(it may get into conflict situation else too), whatever external redirect is there it will happen before itself and then no conflicts with other rules, that's why I mentioned keep it at top of your htaccess rules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.