Question
How to redirect a subdomain to another domain?
Answer
Use one of the following solutions:
Redirect using .htaccess
-
Go to Domains > subdomain.example.com > File Manager and create
.htaccess
file (or open an existing one) : -
Add the following content:
RewriteEngine On RewriteBase /
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]Note: Here www.example.com is the domain to which the redirect is performed
Redirect using Plesk Forwarding hosting type
-
Navigate to Domains > subdomain.example.com > Hosting Settings and click on the [change] button:
-
Change the Hosting type to Forwarding and set up the desired URL:
Note: Forwarding type does not support HTTPS: it cannot be served over HTTPS and will not be secured with a certificate.
Redirect using additional directives
-
Go to Domains > subdomain.example.com >Apache & nginx Settings > Additional nginx directives:
-
Add the following line into the field:
return 301 http://www.example.com/
Note: Here www.example.com is the domain to which the redirect is performed
-
Click on OK button.