You can redirect your one domain to another domain with .htaccess file.
There are various other ways to redirect your domain:
- Redirect from hosting control panel
- Redirect your domain with domain control panel
- Redirect your domain with .htaccess file
Here we are starting with .htaccess file, .htaccess file is a server configuration file and in this file you can make changes especially if you are on shared server. .htaccess file firstly detected and executed by Apache web server according to its functionalities.
You can add below code to redirect your old domain to new domain so that your old traffic can be redirected to new one.
Code:
RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.example1.com [NC] RewriteRule ^(.*)$ https://example2.com/$1 [L,R=301,NC]
Leave a comment: