In DotnetNuke I made a website secure(https), and now it gives a 302 response code first, and then redirects to https

vituxa
vituxa used Ask the Experts™
on
Running a DNN website. Made the entire website https instead of http. Now the first response code it gives me is 302. I need it to be 301 for the SEO purposes.
Do I do it in code? or in IIS? Cannot figure it out.
PLease tell me step-by-step how to implement that.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
PLease tell me how to write a rule in IIS

I added this rule in the IIS and it still 302s:
<rule name="[my 301 to 302]" stopProcessing="true">
            <match url="http://(.*)$" ignoreCase="true" />
            <action type="Redirect" url="https://{R:1}" redirectType="Permanent" />
          </rule>

Open in new window


PLease help!
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Author

Commented:
I am asking for help with either direct instructions or a code sample. PLease help me. I cannot figure this out.
Commented:
Brad thank you for trying. The below is what I was looking for:


<rewrite>
      <rules>
        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
      </rules>
    </rewrite>

Open in new window

Author

Commented:
My answer is the ACTUAL solution to the problem. Brad provided resources.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial