redirect http to https is not working

bugzlife

Registered
Aug 5, 2020
2
0
1
Brunei
cPanel Access Level
Website Owner
hi

using plesk and has an SSL certificate in a domain

if i type : https:/domainname.com or https://www.domainname.com, it secured

but i want it as type www.domainname.com should be automatically redirect to https://domainname.com

enter as below

domainname.com
www.domainname.com

should be redirected to when loading the 1st page


my webconfig is not working :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="NonWwwRedirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.domainname.com\.com$" />
</conditions>
<action type="Redirect" url="https://domainname.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

thanks
bugzlife
 

cPAdminsMichael

Well-Known Member
Dec 19, 2016
132
42
103
Denmark
cPanel Access Level
Root Administrator
Maybe better asking in the Plesk forum? ;-)

In general, you should be able to use a Redirect rule in your website's .htaccess file though.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,255
313
Houston
cPanel forums would not really be the best place to be asking this question. The people at Plesk are experts in their own software and this should indeed be directed to them.