If you are looking to redirect a subfolder to a new domain or want to create a new website on it, then this tutorial will solve your problem. Suppose you have a website example.com and simultaneously you are also running a website on a subfolder say subfolder (i.e. www.example.com/subfolder/), now you want to redirect the subfolder to a new separate website called www.newexample.com. Follow the below steps to do this-
Step 1: Open the file manager of your CMS or access it via FTP.
Step 2: Open the filename in the root directory called .htaccess
Step 3: Paste the following code into the .htaccess file
### BEGIN Redirect /example subdirectory to newexample.com Options +FollowSymLinks RewriteEngine On Redirect 301 /subfolder https://newexample.com/ ### END Redirect /example subdirectory to newexample.com
Note: Don’t forget to replace the domain name with your new domain name.
Also, replace the word subfolder with your old folder name.
If you to redirect the whole domain, then read this article.