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

  • SEARCH
  • Home
  • 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 8869103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:24:17+00:00 2026-06-14T17:24:17+00:00

I use URL Rewriting module for IIS7 – because of URL rewrite for few

  • 0

I use URL Rewriting module for IIS7 – because of URL rewrite for few static files.

Basically I am mapping /pretty-url to /real-file-name.html

So far it is simple.

But after adding query string to pretty url it throws 404 status code. So far I have not found any option to fix this. Any advice, or am I doing something wrong?

Here is the configuration:

<rewriteMaps>
  <rewriteMap name="CoolUrls">
<add key="/pretty-url" value="/real-file.html" />
    ... and so on ...
  </rewriteMap>
</rewriteMaps>

and:

<rules>
  <clear />
    <rule name="Rewrite rule for CoolUrls" stopProcessing="true">
      <match url=".*" />
      <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{CoolUrls:{REQUEST_URI}}" pattern="(.+)" />
      </conditions>
      <action type="Rewrite" url="{C:1}" appendQueryString="true" />
    </rule>
</rules>

Any request with query (any parameters after ? mark) ends with 404 status code.

  • 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-14T17:24:17+00:00Added an answer on June 14, 2026 at 5:24 pm

    I assume you want to be able to add a query string and that this query string has to be appended to the rewritten request. You probably don’t want the query string to be included in the matching in your rewritemap. Because that’s actually what you are doing with {CoolUrls:{REQUEST_URI}} because {REQUEST_URI} also contains the query string. You should replace that with {CoolUrls:{R:0}}.

    Complete rule:

    <rule name="Rewrite rule for CoolUrls" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{CoolUrls:{R:0}}" pattern="(.+)" />
        </conditions>
        <action type="Rewrite" url="{C:1}" appendQueryString="true" />
    </rule>
    

    Update: You should update your rewrite map as {R:0} (the URL) does not include the leading slash from the URL. So your rewrite map should be:

    <rewriteMaps>
        <rewriteMap name="CoolUrls">
            <add key="pretty-url" value="/real-file.html" />
            <add key="another/pretty-url" value="/another/real-file.html" />
            ... and so on ...
        </rewriteMap>
    </rewriteMaps>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use apache rewrite module to do complex rewriting. For example If
I already use URL Rewriting to rewrite /foobar to index.php?username=foobar using: RewriteRule ^([^/.]+)$ /index.php?username=$1
I use url rewriting and one of my urls is /blah/file ILLEGAL CHARS.jpg ILLEGAL
In URL rewriting, i am quite confused that should i use underscore (_) OR
Right now I can use this URL to request a Google Static Maps image
I want to use in-build URL rewriting provided by ASP.NET 4.0. I have tried
I'm using IIS 7.5 on Windows 7 RC. I use the IIS Url Rewrite
I use url rewriting on my site (ASP.NET 4.0 / IIS6), instead of aspx
I am updating a php app, which currently does not use url rewriting. The
I'm writing an MVC3 application that will need to make use of URL rewriting

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.