Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Ritesh 1 post 71 karma points
    Aug 28, 2015 @ 08:33

    Redirect rule


    I want to redirect this url /free-reports?reportid=1259 on this url /free-reports/no-more-metal

    please help me

  • Mark Bowser 265 posts 851 karma points c-trib
    Aug 28, 2015 @ 17:13
    Mark Bowser

    So if someone requests /free-reports/no-more-metal, you want to show them the page at /free-reports?reportid=1259? Is it important for you that the url visibly change? Or do you just want the request to be rewritten?

    If you only care that the query string be passed on but don't need it to be visibly rewritten, you could use the /config/UrlRewriting.config file. An entry like this should do the trick:

        <add name="freeReportsQueryString" 
            ignoreCase="true" />

    If you want the url to be visibly rewritten, I really like to use the IIS Url Rewriting Module for that sort of thing. In the web.config add this:

      <rewriteMaps configSource="config/RewriteMaps.config" />
      <rules configSource="config/RewriteRules.config" />

    And then add those two config files to the /config folder. The RewriteRules.config is for more complex and systematic rewrite rules. In theRewriteRules.config`, just add the following:


    In the RewriteMaps.config, add:

      <rewriteMap name="StaticRedirects">
        <add key="/free-reports/no-more-metal" value="/free-reports?reportid=1259" />

    I'd like to point out that if you go with the above IIS Url Rewriting Module, but forget to install that module on the server running your site, you will get a really, really vague error. Just remember to install the module on every server your site will run on. This probably means installing it on your local machine as well (if it isn't already installed).

    Let me know if this helps at all.

Please Sign in or register to post replies

Write your reply to: