www to non-www not working for subdomain

  • azurelinksc
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 month 1 day ago #10152 by azurelinksc
www to non-www not working for subdomain was created by azurelinksc
I'm on a Plesk server. SCP's "www to non-www" rewrite isn't working on this server. I don't see anything which would conflict in Plesk.
I'm using a subdomain URL, e.g., my.site.org which loads fine. When I type in www.my.site.org , it does not redirect.

This is the code in the htaccess file:
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

Please Log in or Create an account to join the conversation.

More
1 month 1 day ago - 1 month 1 day ago #10153 by Jose
Replied by Jose on topic www to non-www not working for subdomain
Hi azurelink,

Try this: 
Code:
RewriteCond %{HTTP_HOST} ^www.subdomain.example.com$ [NC]RewriteRule ^(.*)$ https://subdomain.example.com/$1 [R=301]

Regards,
Jose
Last edit: 1 month 1 day ago by Jose. Reason: Add more info

Please Log in or Create an account to join the conversation.

Time to create page: 0.145 seconds