• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.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