• We value your experience with Plesk during 2025
    Plesk strives to perform even better in 2026. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2025.
    Please take this short survey:

    https://survey.webpros.com/

Question Redirect subdomain to folder

Hi FelixB,

here you go with some working examples, how to redirect correctly, using apache:

APACHE - NON-WWW - configuration:
Code:
RewriteEngine On
RewriteCond %{SERVER_PORT} !^80$
RewriteCond %{HTTP_HOST} !^(your-domain-OR-sub.domain\.com)?$
RewriteRule ^(.*)$ http://your-domain-OR-sub.domain.com/$1 /squirrelmail [R=301,L]

APACHE - WWW - configuration:
Code:
RewriteEngine On
RewriteCond %{SERVER_PORT} !^80$
RewriteCond %{HTTP_HOST} !^(www\.your-domain-OR-sub.domain\.com)?$
RewriteRule ^(.*)$ http://www.your-domain-OR-sub.domain.com/$1 /squirrelmail [R=301,L]

APACHE - NON-WWW - configuration - HTTPS:
Code:
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_HOST} !^(your-domain-OR-sub.domain\.com)?$
RewriteRule ^(.*)$ https://your-domain-OR-sub.domain.com/$1 /squirrelmail [R=301,L]

APACHE - WWW - configuration - HTTPS:
Code:
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_HOST} !^(www\.your-domain-OR-sub.domain\.com)?$
RewriteRule ^(.*)$ https://www.your-domain-OR-sub.domain.com/$1 /squirrelmail [R=301,L]


Pls. note, that IF you nginx as well, you have to add additional directives for nginx as well!!! ;)
 
Hi UFHH01,
thx for your post but for me and my Plesk Onyx Version 17.5.3 Update-Nr. 19 only the HTTP commands works.
When i try to save the HTTPS commands i got an error:

Plesk-apache-rewriterules.png
Any ideas on that?

best regards,
Darkentik
 
Back
Top