Copied to clipboard

Flag this post as spam?

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


  • Erin Gibbs 9 posts 80 karma points
    Oct 28, 2021 @ 18:25
    Erin Gibbs
    0

    Static Redirects in Web.config

    Hello! I am looking for assistance with static redirects in the web.config file.

    I am publishing a new website for a customer, same domain, just need to keep SEO cred by redirecting their old "[domain].com/contact.php" url to the new "[domain].com/contact/" (and about 8 other pages like that).

    I'm used to using a rewritemap.config in the root folder, and then having the configSource here:

    <rewrite>
         <rewriteMaps configSource="rewritemaps.config" />     
          <rules>
                <rule name="Redirect rule1 for Redirects">
                  <match url=".*" />
                  <conditions>
                  <add input="{Redirects:{REQUEST_URI}}" pattern="(.+)" />
                  </conditions>
                  <action type="Redirect" url="{C:1}" appendQueryString="false" />
          </rules>
        </rewrite> 
    

    However, the syntax has changed and what I've tried didn't take for some reason. Any help is appreciated!

  • Jonathon Cove 26 posts 101 karma points
    May 12, 2022 @ 13:05
    Jonathon Cove
    0

    I know this is an old question, but I found you can use the standard IIS rerouting method. Here's an article I found helpful: https://blog.elmah.io/web-config-redirects-with-rewrite-rules-https-www-and-more

Please Sign in or register to post replies

Write your reply to:

Draft