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. Intermediate & Advanced SEO
    4. NGinx rule for redirecting trailing '/'

    NGinx rule for redirecting trailing '/'

    Intermediate & Advanced SEO
    2 2 92
    • 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.
    • AbsoluteDesign
      AbsoluteDesign last edited by

      We have successfully implemented run-of-the-mill 301s from old URLs to new (there were about 3,000 products). As normal. Like we do on every other site etc.

      However, recently search console has started to report a number of 404s with the page names with a trailing forward slash at the end of the .html suffix.

      So, /old-url.html is redirecting (301) to /new-url.html

      However, now for some reason /old-url.html/ has 'popped up' in the Search Console crawl report as a 404.

      Is there a 'blobal' rule you can write in nGinx to say redirect *.html/ to */html (without the forward slash) rather than manually doing them all?

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

        Hi there.

        Yes, the global rule should work. However, there is a reason this is happening, and it look like there is an extra rule, which adds that trailing slash. Go through those new rules you've added, make sure that you don't have anything extra. Example might be "Redirect everything from old blog to new blog with adding trailing slash" or something. It's quite common error, so you should be able to figure it out.

        Also see when these 404s were discovered, if it was right after you did redirects, it means for sure, that some of the new redirect rules are messed up at some point.

        Cheers!

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        • Redirect wordpress from /%post_id%/%postname%/ to /blog/%postname%/
          Taiger
          Taiger
          0
          3
          446

        • Help with https// redirects
          ForForce
          ForForce
          0
          5
          317

        • Is 301 redirecting your index page to the root '/' safe to do or do you end up in an endless loop?
          MikeRoberts
          MikeRoberts
          0
          4
          136

        • Should /node/ URLs be 301 redirect to Clean URLs
          MargaritaS
          MargaritaS
          0
          3
          172

        • 'Select your country' page leading to high Temporary Redirects
          Bio-RadAbs
          Bio-RadAbs
          0
          3
          312

        • Question about 301 redirect for trailing / ?
          YannickVeys
          YannickVeys
          0
          4
          524

        • Our site is recieving traffic for both .com/page and .com/page/ with the trailing slash.
          Profero
          Profero
          0
          5
          670

        • Posing QU's on Google Variables "aclk", "gclid" "cd", "/aclk" "/search", "/url" etc
          0
          1
          2.3k

        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