Solved

URL Rewrite and http to https

Posted on 2015-02-04
6
93 Views
Last Modified: 2015-02-05
Hello,

I'm running IIS 7. I need to have all attempts at http://www.domain.com/dir1/x.asp or whatever URL in the domain be redirected to use https. I'm assuming URL Rewrite is the best way to do this.

What is the rule that would do this for me?

Thanks in advance,

Steve
0
Comment
Question by:skbohler
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
lruiz52 earned 500 total points
ID: 40589102
HI,

Check out the link below, it gives directions on setting up http redirects to HTTPS.

http://www.jppinto.com/2009/04/automatically-redirect-http-requests-to-https-iis-7/
0
 
LVL 33

Expert Comment

by:it_saige
ID: 40589362
When doing a URL rewrite, I use the URL Rewrite Moedule from Microsoft:  http://www.iis.net/downloads/microsoft/url-rewrite

1. Once installed, close and reopen IIS.

2. Browse to the site you want to create a Rewrite rule for.

3. Open the URL Rewrite module.

Capture.JPG

4. Add a rule using the Add Rule wizard

Click the 'Add Rule(s)...' shortcut.Choose 'Blank Rule' under the 'Inbound Rules' section.Type 'HTTP to HTTPs' in the Name textbox.In the 'Match URL' section, use the following settings.In the 'Conditions' section, add a new Condition with the following settings.This is how your 'Conditions' section should look after you add the new Condition.In the 'Action' section, make the following changes.Save the changes using the 'Apply' link.After applying the changes, reopen the URL Rewrite feature.  You should see your new rule.
-saige-
0
 

Author Comment

by:skbohler
ID: 40592145
I've put in the redirect location as: <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />

It works for the root URL (http://www.domain.com). However, when I try to browse directly to, say, http://www.domain.com/dir1/file.php, it redirects the browser to https://www.domain.com/index.php. It's not appending it seems.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 33

Expert Comment

by:it_saige
ID: 40592335
Make sure that you do not have anything in the root web.config, the dir1 directory web.config (if one exists) or the fie.php file that redirects to index.php.

-saige-
0
 

Author Comment

by:skbohler
ID: 40592425
Thanks. It turned out to be another URL Rewrite entry ahead of it that was causing the issue.
0
 
LVL 33

Expert Comment

by:it_saige
ID: 40592426
No problem.

-saige-
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question