• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue 301 redirection from Alias Domains to the Main Domain with https:// and www.

Klaus Becker

New Pleskian
How to make a 301 redirection from the Alias Domains to the Main Domain, which has "https://" and "www." too?

There is an option in Plesk for the Alias Domains, that is called "Redirect with the HTTP 301 code". But this option doesn't work, if the Main Domain is SSL protected (https://).

In this case the Alias Domains aren't redirected to the Main Domain at all, but only security warnings appear (insecure connection).

I use Plesk Onyx and Apache with Nginx reverse proxy server.

Example:

-----

1.) Main Domain ==> https://www.main-domain.com

2.) Alias Domains ==>

http://alias-domain.com
http://www.alias-domain.com

https://alias-domain.com
https://www.alias-domain.com

-----

Thanks for your help!
 
Last edited:
This will also not work if you access the alias domain via https, because you do not have a certificate for that.
What we did:
  1. configure the alias domain like a regular domain
  2. enable Let's Encrypt
  3. create a .htaccess that redirects to the main domain including https and www., while keeping the Let's Encrypt verification url local, in our case:
    Code:
    # damit Let's Encrypt aktualisieren kann ...
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !.well-known
    RewriteRule ^.*$ https://www.sourcetronic.com/shop/de/ [R=301,L]
Works for us. Would be nicer if plesk could do that on its own, though.

(It would also be nice if the forum could stop interpreting the URL and replacing its text with the page title. I hope it works with BBCode now.)
 
Last edited:
Thanks for your suggestion.

Plesk writes about this problem in a help topic too ==> SSL 301 redirection for domain alias

But, unfortunately, the information given by Plesk is wrong in two points:

1.) The Alias http://alias.com for the main domain https://example.com is not redirected to https://example.com, as Plesk says, but to https://alias.com at first. This causes a security warning.

2.) There is not a "Permanent 301-redirect from HTTP to HTTPS option" in Plesk. In reality there is just a simple "301-redirect from HTTP to HTTP option" in Plesk, which doesn't work if the Main Domain is SSL protected (HTTPS).


PROBLEM:

Plesk redirects an Alias Domain to the https:// protocol of this Alias Domain at first, if the Main Domain is SSL protected. This causes a security alert.

You could avoid the security alert only, if you protect the Alias Domain by SSL too, but this doesn't solve the actual problem about the seo-friendly 301-redirection from the Alias Domain to the Main Domain with SSL yet. So obviously it's not possible to solve this problem in Plesk.


QUESTION / SUGGESTION:

Is it possible to insert some code in the fields "Additional Directives" (panel "Websites and Domains >> Apache & nginx Settings") instead of using a .htaccess file for the 301 redirections?

Which code to write in these fields "Additional Directives" to create a 301 redirection from any Alias Domains to the Main Domain with "https://" and "www." ?


Thank you!
 
Last edited:
2.) There is not a "Permanent 301-redirect from HTTP to HTTPS option" in Plesk. In reality there is just a simple "301-redirect from HTTP to HTTP option" in Plesk, which doesn't work if the Main Domain is SSL protected (HTTPS).

permanent 301.png

A 301 is a permanent redirect, as opposed to a temporary one.
E.g. Firefox will aggressively cache such a redirect (making it forget one involves deleting at least part of your cache).

QUESTION / SUGGESTION:

Is it possible to insert some code in the fields "Additional Directives" (panel "Websites and Domains >> Apache & nginx Settings") instead of using a .htaccess file for the 301 redirections?
Which code to write in these fields "Additional Directives" to create a 301 redirection from any Alias Domains to the Main Domain with "https://" and "www." ?

Any such redirects must, however, exclude the directory where Let'sEncrypt expects its keys.
 
Back
Top