We help IT Professionals succeed at work.

Simple IIS URL Rewrite needed

skbohler
skbohler asked
on
138 Views
Last Modified: 2017-12-11
Hello,

I need to create a simple IIS URL Rewrite rule that does the following:

If user accesses http (or https)://folder1/filea.asp

Redirect user to: http (or https)://folder2/filea.asp

Thanks in advance,

Steve
Comment
Watch Question

Olivier MARCHETTACitrix Support and Infrastructure Engineer
CERTIFIED EXPERT

Commented:
Hello. You can install the IIS rewrite module from this page :
https://www.iis.net/downloads/microsoft/url-rewrite

Then you can use this guide :
https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

1. Create a default website
2. Open the URL Rewrite module in the webpage configuration panel
3. Create a blank rule
4. Enter the pattern or the expression you want to rewrite.
CERTIFIED EXPERT

Commented:
try and see if this work for you in http / https?

(tested working in http)

<rule name="RewriteUserFriendlyURL" enabled="true" stopProcessing="true">
                    <match url="^folder1/([^/]+)/?$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Redirect" url="folder2/{R:1}" appendQueryString="false" />
                </rule>

Open in new window

Author

Commented:
Hi Ryan,
Thanks for the reply.

Does that rule work for both http and https?

I have a finite list of URLs that I need to redirect from one directory to another. So, I believe I the matchURL should be something more specific than <match url="^folder1/([^/]+)/?$" />, no?

Wouldn't that rule apply to all files in folder1?
CERTIFIED EXPERT

Commented:
Does that rule work for both http and https?
you probably can try it out, as I don't have a https site for testing. it should worked for both http and https.

Wouldn't that rule apply to all files in folder1?
yes
CERTIFIED EXPERT

Commented:
any further clarification is needed here?

Author

Commented:
I needed a versions that works for a specific file in a specific directory. Not all files in a specific directory. How can I achieve that?

Thank you.
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions