The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. Web config redirects not working where a trailing slash is involved

    Web config redirects not working where a trailing slash is involved

    Technical SEO Issues
    5 2 6.4k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • AndrewAkesson
      AndrewAkesson last edited by

      I'm having real trouble with getting working redirects in place to use on a site we're re-launching with a modified url structure.

      Old URL: http://www.example.com/example_folder/

      New URL: http://www.example.com/example-of-new-folder/

      Now, where the old URL's have a trailing slash the web.config simply will not accept it. It says the URL can start with a slash, but not end with a slash. However, many of my URL's do end with a slash so I need a workaround.

      These are the rules I'm putting in place:

      <location path="example_folder/"></location>

      Thanks

      1 Reply Last reply Reply Quote 0
      • AlanMosley
        AlanMosley last edited by

        i would first decide if you want a slash or not. i prefer not as when people type urls they rarly add a slash on the end.

        see this page will tell you how to remove all slashes and then your redirects should work

        http://thatsit.com.au/seo/tutorials/how-to-fix-canonical-issues-involving-the-trailing-slash

        AndrewAkesson 1 Reply Last reply Reply Quote 0
        • AndrewAkesson
          AndrewAkesson @AlanMosley last edited by

          Thanks for the response Alan.

          However, the problem is with the old URL's, so where they have a trailing slash I cannot get them to redirect to any URL's of the new structure (with a trailing slash or otherwise.).

          To simplify the ask, how do I put in place a 301 redirect from 'http://www.example.com/example_folder/' to some other URL?

          AlanMosley 1 Reply Last reply Reply Quote 0
          • AlanMosley
            AlanMosley @AndrewAkesson last edited by

            The following will work for both slash and no slash,

            <rule name="Test" stopprocessing="true"><match url="^example_folder"><action type="Redirect" url="/newfolder"></action></match></rule>

            if not sure where to place it, see link in last post, bottom of page

            1 Reply Last reply Reply Quote 1
            • AndrewAkesson
              AndrewAkesson last edited by

              That works perfectly, thank you very much

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • Massive jump in amount of pages being crawled - from lazyload or trailing slash redirects??
                0
                1
                43

              • Trailing Slashes on URLs
                GastonRiera
                GastonRiera
                0
                2
                146

              • Redirect non slash to slash
                dexport
                dexport
                0
                4
                924

              • Trailing Slashes and SEO
                max.favilli
                max.favilli
                0
                8
                634

              • Redirecting special characters in .htaccess and web.config
                stephenfishman
                stephenfishman
                0
                7
                10.6k

              • 301 redirect not working
                BlueprintMarketing
                BlueprintMarketing
                0
                12
                4.5k

              • Why are my URL's with a trailing slash still getting indexed even though they are redirected in the .htaccess file?
                irvingw
                irvingw
                0
                3
                288

              • OSE says URL redirects to URL with trailing slash but it doesn't.
                rock22
                rock22
                0
                5
                211

              Get started with Moz Pro!

              Unlock the power of advanced SEO tools and data-driven insights.

              Start my free trial
              Products
              • Moz Pro
              • Moz Local
              • Moz API
              • Moz Data
              • STAT
              • Product Updates
              Moz Solutions
              • SMB Solutions
              • Agency Solutions
              • Enterprise Solutions
              • Digital Marketers
              Free SEO Tools
              • Domain Authority Checker
              • Link Explorer
              • Keyword Explorer
              • Competitive Research
              • Brand Authority Checker
              • Local Citation Checker
              • MozBar Extension
              • MozCast
              Resources
              • Blog
              • SEO Learning Center
              • Help Hub
              • Beginner's Guide to SEO
              • How-to Guides
              • Moz Academy
              • API Docs
              About Moz
              • About
              • Team
              • Careers
              • Contact
              Why Moz
              • Case Studies
              • Testimonials
              Get Involved
              • Become an Affiliate
              • MozCon
              • Webinars
              • Practical Marketer Series
              • MozPod
              Connect with us

              Contact the Help team

              Join our newsletter
              Moz logo
              © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
              • Accessibility
              • Terms of Use
              • Privacy