1
votes

So basically I have 2 domains, domain1.com and domain2.com

For domain2.com, I want to redirect it to domain1.com and keep the rest of the URL path intact.

For example:

domain2.com/same/url/path would redirect to domain1.com/same/url/path

How do I do this?

1

1 Answers

1
votes

Use this rule in website root .htaccess of domain2:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)?domain2\.com$ [NC]
RewriteRule ^ http://domain1.com%{REQUEST_URI} [R=301,L,NE]