Plesk

How to redirect a subdomain to another domain?

Question

How to redirect a subdomain to another domain?

Answer

Use one of the following solutions:

Redirect using .htaccess

  1. Log into Plesk

  2. Go to Domains > subdomain.example.com > File Manager and create .htaccess file (or open an existing one) :

  3. 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

  1. Log into Plesk

  2. Navigate to Domains > subdomain.example.com > Hosting Settings and click on the [change] button:

  3. 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

  1. Log into Plesk

  2. Go to Domains > subdomain.example.com >Apache & nginx Settings > Additional nginx directives:

  3. 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

  4. Click on OK button.

Exit mobile version