undefined
Skip to content
Moz logo Menu open Menu close
  • Products
    • Moz Pro
    • Moz Pro Home
    • Moz Local
    • Moz Local Home
    • STAT
    • Moz API
    • Moz API Home
    • Compare SEO Products
    • Moz Data
  • Free SEO Tools
    • Domain Analysis
    • Keyword Explorer
    • Link Explorer
    • Competitive Research
    • MozBar
    • More Free SEO Tools
  • Learn SEO
    • Beginner's Guide to SEO
    • SEO Learning Center
    • Moz Academy
    • SEO Q&A
    • Webinars, Whitepapers, & Guides
  • Blog
  • Why Moz
    • Agency Solutions
    • Enterprise Solutions
    • Small Business Solutions
    • Case Studies
    • The Moz Story
    • New Releases
  • Log in
  • Log out
  • Products
    • Moz Pro

      Your all-in-one suite of SEO essentials.

    • Moz Local

      Raise your local SEO visibility with complete local SEO management.

    • STAT

      SERP tracking and analytics for enterprise SEO experts.

    • Moz API

      Power your SEO with our index of over 44 trillion links.

    • Compare SEO Products

      See which Moz SEO solution best meets your business needs.

    • Moz Data

      Power your SEO strategy & AI models with custom data solutions.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Free SEO Tools
    • Domain Analysis

      Get top competitive SEO metrics like DA, top pages and more.

    • Keyword Explorer

      Find traffic-driving keywords with our 1.25 billion+ keyword index.

    • Link Explorer

      Explore over 40 trillion links for powerful backlink data.

    • Competitive Research

      Uncover valuable insights on your organic search competitors.

    • MozBar

      See top SEO metrics for free as you browse the web.

    • More Free SEO Tools

      Explore all the free SEO tools Moz has to offer.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Learn SEO
    • Beginner's Guide to SEO

      The #1 most popular introduction to SEO, trusted by millions.

    • SEO Learning Center

      Broaden your knowledge with SEO resources for all skill levels.

    • On-Demand Webinars

      Learn modern SEO best practices from industry experts.

    • How-To Guides

      Step-by-step guides to search success from the authority on SEO.

    • Moz Academy

      Upskill and get certified with on-demand courses & certifications.

    • MozCon

      Save on Early Bird tickets and join us in London or New York City

    Unlock flexible pricing & new endpoints
    Moz API

    Unlock flexible pricing & new endpoints

    Find your plan
  • Blog
  • Why Moz
    • Small Business Solutions

      Uncover insights to make smarter marketing decisions in less time.

    • Agency Solutions

      Earn & keep valuable clients with unparalleled data & insights.

    • Enterprise Solutions

      Gain a competitive edge in the ever-changing world of search.

    • The Moz Story

      Moz was the first & remains the most trusted SEO company.

    • Case Studies

      Explore how Moz drives ROI with a proven track record of success.

    • New Releases

      Get the scoop on the latest and greatest from Moz.

    Surface actionable competitive intel
    New Feature

    Surface actionable competitive intel

    Learn More
  • Log in
    • Moz Pro
    • Moz Local
    • Moz Local Dashboard
    • Moz API
    • Moz API Dashboard
    • Moz Academy
  • Avatar
    • Moz Home
    • Notifications
    • Account & Billing
    • Manage Users
    • Community Profile
    • My Q&A
    • My Videos
    • Log Out

The Moz Q&A Forum

  • Forum
  • Questions
  • Users
  • Ask the Community

Welcome to the Q&A Forum

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

  1. Home
  2. SEO Tactics
  3. Technical SEO
  4. Web config redirects not working where a trailing slash is involved

Moz Q&A is closed.

After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

Web config redirects not working where a trailing slash is involved

Technical SEO
2
5
7.0k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as question
Log in to reply
This topic has been deleted. Only users with question management privileges can see it.
  • AndrewAkesson
    AndrewAkesson last edited by Mar 26, 2012, 7:20 AM

    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
    • AndrewAkesson
      AndrewAkesson last edited by Mar 26, 2012, 10:55 AM Mar 26, 2012, 10:55 AM

      That works perfectly, thank you very much

      1 Reply Last reply Reply Quote 0
      • AlanMosley
        AlanMosley @AndrewAkesson last edited by Mar 26, 2012, 10:54 AM Mar 26, 2012, 9:42 AM

        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 @AlanMosley last edited by Mar 26, 2012, 9:30 AM Mar 26, 2012, 9:30 AM

          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 Mar 26, 2012, 9:42 AM Reply Quote 0
          • AlanMosley
            AlanMosley last edited by Mar 26, 2012, 8:48 AM Mar 26, 2012, 8:48 AM

            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 Mar 26, 2012, 9:30 AM Reply Quote 0
            • 1 / 1
            1 out of 5
            • First post
              1/5
              Last post

            Got a burning SEO question?

            Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


            Start my free trial


            Browse Questions

            Explore more categories

            • Moz Tools

              Chat with the community about the Moz tools.

            • SEO Tactics

              Discuss the SEO process with fellow marketers

            • Community

              Discuss industry events, jobs, and news!

            • Digital Marketing

              Chat about tactics outside of SEO

            • Research & Trends

              Dive into research and trends in the search industry.

            • Support

              Connect on product support and feature requests.

            • See all categories

            Related Questions

            • HashtagHustler

              Cant find source of redirect

              Hey guys, I have a bizarre situation on my hands. I have a URL that is being wonky. The url is redirecting to another url and the 301 redirect is not in my htaccess. There is a 301 redirect in my htaccess but is being overwritten by something else, i.e. whatever is happening in above. So basically URL A should be redirecting to URL B but instead its going to URL C. I know we were not hacked, it's not redirecting to a strange bizarre domain. I have also disabled all of our plugins that redirect (to my knowledge) Any thoughts would be great!

              Technical SEO | Mar 27, 2019, 6:59 PM | HashtagHustler
              0
            • rwat

              Redirect and ranking issue

              Hi there - was wondering whether someone might be able to help. For a period of a day and a half, all the traffic to our website's blog articles were mistakenly being redirected to our homepage. A number of these articles ranked in the top 5 in Google worldwide for their targeted keywords, so this was a considerable amount of organic traffic that was instantly being redirected. It was a strange site glitch and our web team rectified the error, but now all these articles have disappeared from Google rankings (not visible anywhere in the first five pages). I'm presuming this must be linked to this redirect issue - we've been advised to wait and see whether Google restores these rankings, but I'm still concerned as to whether this represents a more serious problem? We have re-indexed the pages we are most concerned about, but am not sure whether there is anything else obvious we should think to do. If anyone has any thoughts, I'd be happy to hear them!

              Technical SEO | Jan 15, 2018, 4:11 PM | rwat
              0
            • AaronHenry

              WPEngine Causing Redirect Chain

              Hi guys, Had a quick question that I wanted to verify here. After reviewing a Moz report we received some redirect chain error on all of our sites hosted with WPEngine. We noticed that the redirect chain appears to be coming from how the domains are configured in their control panel. Essentially, there is a redirect: from staging/temp -> to live from non-www -> to www SSL redirect from http -> https The issue here is that the non-www is redirecting to www and then redirected again to https://www According to support the only way to get rid of this error is to drop the www version of the domain and to host everything under https://domain.com. To me it seems very odd that you cannot just go from http://non-www to https://www in just 1 301 redirect. Has anyone else experienced this or am I just not looking at the situation correctly?

              Technical SEO | Aug 10, 2022, 4:01 PM | AaronHenry
              0
            • Uber_

              Add trailing slash after removing .html extention

              My website is non www ,it has wordpress in subdirectory and some static webpages in the root and other subdirectory 1. i want to remove .html extention from the webpages in the root and
              the others static webpages in subdirectory.
              2. add slash at the end.
              3. 301 redirect from non slash to url with slash. so it should be http://ghadaalsaman.com/articles.html to http://ghadaalsaman.com/articles/ and http://ghadaalsaman.com/en/poem-list.html to http://ghadaalsaman.com/en/poem-list/ the below code 1. working with non slash at the end **2. **redirect 301 url with slash to non here's my .htaccess <ifmodule mod_rewrite.c="">Options +FollowSymLinks -MultiViews RewriteEngine On
              RewriteBase /</ifmodule> #removing trailing slash
              RewriteCond %{REQUEST_FILENAME} !-d     
              RewriteRule ^(.*)/$ $1 [R=301,L] #www to non
              RewriteCond %{HTTP_HOST} ^www.(([a-z0-9_]+.)?domain.com)$ [NC]
              RewriteRule .? http://%1%{REQUEST_URI} [R=301,L] #html
              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_FILENAME} !-d
              RewriteRule ^([^.]+)$ $1.html [NC,L] #index redirect
              RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.html\ HTTP/
              RewriteRule ^index.html$ http://ghadaalsaman.com/ [R=301,L]
              RewriteCond %{THE_REQUEST} .html
              RewriteRule ^(.*).html$ /$1 [R=301,L] PS everything is ok with the wordpress , the problems with static pages only. Thanks in advanced

              Technical SEO | Jul 31, 2016, 7:51 PM | Uber_
              0
            • Francis.Magos

              Why does my Google Web Cache Redirects to My Homepage?

              Why does my Google Webcache appears in a short period of time and then automatically redirects to my homepage? Is there something wrong with my robots.txt? The only files that I have blocked is below: User-agent: * Disallow: /bin/ Disallow: /common/ Disallow: /css/ Disallow: /download/ Disallow: /images/ Disallow: /medias/ Disallow: /ClientInfo.aspx Disallow: /*affiliateId* Disallow: /*referral*

              Technical SEO | Jun 16, 2016, 6:08 AM | Francis.Magos
              0
            • Kilgray

              Robots txt. in page with 301 redirect

              We currently have a a series of help pages that we would like to disallow from our robots txt. The thing is that these help pages are located in our old website, which now has a 301 redirect to current site. Which is the proper way to go around? 1- Add the pages we want to disallow to the robots.txt of the new website? 2- Break the redirect momentarily and add the pages to the robots.txt of the old one? Thanks

              Technical SEO | Mar 7, 2016, 2:13 PM | Kilgray
              0
            • Therealmattyd

              301 Redirects in subfolders

              Hi, we're making our site into a static site but I would like to transfer the Google juice. Most of the links and database exist on subfolders though. Could I simply do 301 redirects on the subfolders and retain the value or does it have to be on the full domain?

              Technical SEO | May 20, 2014, 10:32 AM | Therealmattyd
              0
            • cmjolley

              Trailing Slash Problems

              Link juice being split between trailing slash and non versions.  ie.  ldnwicklesscandles.com/scentsy-uk and ldnwicklesscandles.com/scentsy-uk/ Initially asked in here and was told to do a rewrite in the htaccess file. I don't have access to this with squarespace, nor can I add canonical tags on a page by page basis. 301 redirect from scentsy-uk to scentsy-uk/ didn't work either...said that the redirect wasn't completing in an error message on the browser. Squarespace hasn't been very helpful at all. My question is....is there another way to fix this? or should I just call it a day with squarespace and move to wordpress?

              Technical SEO | Feb 19, 2016, 3:28 PM | cmjolley
              0

            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
            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 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
            • Accessibility
            • Terms of Use
            • Privacy

            Looks like your connection to Moz was lost, please wait while we try to reconnect.