Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:59:38+00:00 2026-06-04T12:59:38+00:00

I use IIS 7.5 and URL Rewrite. I have a website with the following

  • 0

I use IIS 7.5 and URL Rewrite.

I have a website with the following file hierarchy:

webroot
webroot/LegacySite

Both webroot/ and legacy/ are separate App-Folders in IIS.


I need to rewrite my URLs so:

  • If a request is http://mysite.co/LegacySite/page.aspx the URL will be rewritten to http://mysite.co/page.aspx

Below my Web.Conf (in the webroot folder) does not work properly, could you point out what I’m missing?

<?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="MyRole" stopProcessing="true">
                        <match url=".*" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="^mysite.com" />
                            <add input="{PATH_INFO}" pattern="^\LegacySite\" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="\LegacySite\{R:0}" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:59:39+00:00Added an answer on June 4, 2026 at 12:59 pm

    The following should work:

    <rule name="MyRole" stopProcessing="true">
        <match url="LegacySite/(.*)" />
        <conditions>
            <add input="{HTTP_HOST}" pattern="^mysite.com$" />
        </conditions>
        <action type="Rewrite" url="/{R:1}" appendQueryString="true" />
    </rule>
    

    You might want to drop the conditional for checking the host name. Is that really important? Do you have any other domain names bound to that website for which you don’t want the redirect to happen? It seems unnecessary. You probably only need:

    <rule name="MyRole" stopProcessing="true">
        <match url="LegacySite/(.*)" />
        <action type="Rewrite" url="/{R:1}" appendQueryString="true" />
    </rule>
    

    I’ve added appendQueryString="true" to pass any (optional) query string parameters to the rewritten URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am implementing URL REWRITE (IIS 7) in a client's website. but I have
I'm trying to use IIS Isapi Rewrite to do the following... I need seo-friendly
I'm using IIS 7.5 on Windows 7 RC. I use the IIS Url Rewrite
I am trying to use IIS URL rewrite to take a user to a
I'm trying to use the IIS 7 URL Rewrite feature for the first time,
I use URL Rewrite on IIS 7.5 and I created a rule to rewrite
I use IIS 7.5 I have a website wich has a valid host like:
I am using URL Rewrite module 2 in IIS 7. I have a certain
I used IIS 7 URL rewrite module 2 to convert my .htaccess file to
I'd like to use my IIS logs to track sessions in my app, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.