Introduction
This article will provide details on how to redirect all pages of a domain to the same pages on another domain. For example, a request for http://domain1.tld/example will redirect to http://domain2.tld/example
Procedure
1. Open the .htaccess file in the document root of the domain that will be redirected. If the .htaccess file does not exist then the file can be created.
2. Add the following: (replace domain1.tld with the domain that will be redirected and domain2.tld with the domain that is being redirected to.)
RewriteCond %{HTTP_HOST} ^domain\.tld$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain1\.tld$
RewriteRule ^(.*)$ "https\:\/\/domain2.tld\/$1" [R=301,L]
Note: If a CMS such as WordPress is in use then the above rewrites will need to be added before the WordPress or other CMS rewrites.
Comments
0 comments
Article is closed for comments.