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. Intermediate & Advanced SEO
    4. Infinite Redirect Loop without trailing slash, please help

    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.

    Infinite Redirect Loop without trailing slash, please help

    Intermediate & Advanced SEO
    3
    11
    3838
    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.
    • debc
      debc last edited by

      I've been searching for an answer all day, I can't seem to figure this out.

      When I Fetch my blog as Google(http://www.mysite.com/blog) WITHOUT a trailing slash at the end, I get this error:

      The page seems to redirect to itself. This may result in an infinite redirect loop

      **HTTP/1.1 301 Moved Permanently**

      When I Fetch my blog as Google WITH the trailing slash at the end(http://www.mysite.com/blog/), it is fine without errors.

      When I pull it up in a browser comes up fine both with and without the trailing slash.

      My .htaccess file in the root directory contains this:

      RewriteEngine On
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.htm\ HTTP/
      RewriteRule ^index.htm$ http://www.mysite.com/ [R=301,L]
      RewriteCond %{HTTP_HOST} ^mysite.com$
      RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]

      My .htaccess file in the blog directory contains this:

      BEGIN WordPress

      <ifmodule mod_rewrite.c="">RewriteEngine On
       RewriteBase /blog/
       RewriteCond %{REQUEST_URI} ^./index.php/. [NC]
       RewriteRule ^index.php/(.*)$ http://www.mysite.com/blog/$1 [R=301,L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /blog/index.php [L]</ifmodule>

      END WordPress

      Do I have something incorrectly coded in these .htaccess files that could be causing this? Or is there something else I should look at? Thank you for any help!!

      1 Reply Last reply Reply Quote 0
      • debc
        debc @debc last edited by

        I combined the htaccess files (putting the blog rewrite rule to the bottom of the file) now having just one htacess in the root directory and unfortunately it did not work. When I tried it, all the links on the blog would not work, they were all "page not found" so I reverted it back to what I originally had... Here is what the combined htaccess file looked like:

        RewriteEngine On
        RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.htm\ HTTP/
        RewriteRule ^index.htm$ http://www.example.com/ [R=301,L]
        RewriteCond %{HTTP_HOST} ^example.com$
        RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

        <ifmodule mod_rewrite.c="">RewriteEngine On
         RewriteBase /blog/
         RewriteCond %{THE_REQUEST} ^./index.php/. [NC]
         RewriteRule ^index.php/(.*)$ http://www.example.com/blog/$1 [R=301,L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /blog/index.php [L]</ifmodule>

        Thanks again for any insight!

        1 Reply Last reply Reply Quote 0
        • SEOKeith
          SEOKeith @debc last edited by

          Hey Debora,

          Any luck?

          Keith

          1 Reply Last reply Reply Quote 0
          • GeorgeAndrews
            GeorgeAndrews @debc last edited by

            Hello Debora,

            Make sure you keep copies of your .htaccess files before you make changes and, if you can, use a test site to test your changes first before you make changes on your live website.

            I'm not sure how your website is set up so I don't know if combining the two files will accomplish what you are looking for.

            Whatever you do, make sure you have backups.

            1 Reply Last reply Reply Quote 0
            • SEOKeith
              SEOKeith @debc last edited by

              Yes as I said above 🙂

              1 Reply Last reply Reply Quote 0
              • debc
                debc @debc last edited by

                Thanks for your response Keith, I'll give it a try and let you know!

                1 Reply Last reply Reply Quote 0
                • debc
                  debc @GeorgeAndrews last edited by

                  Thanks George.  Please forgive me, I am a newbie at this!  I took a look at the link you provided, and I don't fully understand what they are explaining.  What I did understand is that having 2 htaccess files in different directories caused a problem with their code.  Do you think combining the two files into one on the root directory will make a difference for me?

                  SEOKeith GeorgeAndrews 2 Replies Last reply Reply Quote 0
                  • SEOKeith
                    SEOKeith @debc last edited by

                    Sorry, I completely misread this question (I missed the part where you said you had to .htaccess files!).

                    Yes put one .htaccess file in the root dir, add the blog rewrite rule to the bottom of the file.

                    Let me know how it goes.

                    Keith

                    1 Reply Last reply Reply Quote 0
                    • debc
                      debc @SEOKeith last edited by

                      Thanks Keith.  I tried it and it is still looping.  Do you think it has something to do with having 2 different .htaccess files?  Should I combine them into just one in the root directory?

                      SEOKeith debc 4 Replies Last reply Reply Quote 0
                      • SEOKeith
                        SEOKeith last edited by

                        Yuk mod_rewrite...

                        Try:

                        RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php\ HTTP/
                        RewriteRule ^index.php$ http://www.example.com/blog/ [R=301,L]

                        You may wish to add $1 on the end

                        RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php\ HTTP/
                        RewriteRule ^index.php$ http://www.example.com/blog/$1 [R=301,L]

                        Let me know if that stops it looping...

                        Keith

                        debc 1 Reply Last reply Reply Quote 0
                        • GeorgeAndrews
                          GeorgeAndrews last edited by

                          Try here. Maybe that will help.

                          Edit: Pretty sure it's your root directory .htaccess file that is causing the looping. I'd start with that.

                          debc 1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            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

                          • Caffeine_Marketing

                            We are redirecting http and non www versions of our website. Should all versions http (non www version and www version) and https (non www version) should just have 1 redirect to the https www version?

                            We are redirecting http and non www versions of our website. Should all versions http (non www version and www version) and https (non www version) should just have 1 redirect to the https www version? Thant way all forms of the website are pointing to one version?

                            Intermediate & Advanced SEO | | Caffeine_Marketing
                            0
                          • alex_goldman

                            All URLs in the site is 302 redirected to itself

                            Hi everyone, I have a problem with a website wherein all URLs (homepage, inner pages) are 302 redirected. This is based on Screaming Frog crawl. But the weird thing is that they are 302 redirected to themselves which doesn't make any sense. Example:
                            https://www.example.com.au/ is 302 redirected to https://www.example.com.au/ https://www.example.com.au/shop is 302 redirected to https://www.example.com.au/shop https://www.example.com.au/shop/dresses is 302 redirected to https://www.example.com.au/shop/dresses Have you encountered this issue? What did you do to fix it? Would be very glad to hear your responses. Cheers!

                            Intermediate & Advanced SEO | | alex_goldman
                            0
                          • Angelos_Savvaidis

                            Multilingual Site and 301 redirection

                            Hey there awesome people of Moz I have this site that has many languages in it. The main language is English and my developer did the following www.example.com ( is the main site ) which redirects with a 301 to www.example.com/en if your geo location is supported by our languages then you will automatically be redirected to whatever language you have in your country but does the first language with is english have to 301 redirect to www.example.com/en ? I thought that the right way is to just leave /en at the root file. Thanks in advance

                            Intermediate & Advanced SEO | | Angelos_Savvaidis
                            0
                          • alexkatalkin

                            Problem with redirects in coldfusion

                            How to redirect pages in cold fusion? If using ColdFusion and modrewrite, the URL will never be redirected from ModRewrite.

                            Intermediate & Advanced SEO | | alexkatalkin
                            0
                          • jasonwdexter

                            Redirect ruined domain to new domain without passing link juice

                            A new client has a domain which has been hammered by bad links, updates etc and it's basically on its arse because of previous SEO guys. They have various domains for their business (brand.com, brand.co.uk) and want to use a fresh domain and take it from there. Their current domain is brand.com (the ruined one). They're not bothered about the rankings for brand.com but they want to redirect brand.com to brand.co.uk so that previous clients can find them easily. Would a 302 redirect work for this? I don't want to set up a 301 redirect as I don't want any of the crappy links pointing across. Thanks!

                            Intermediate & Advanced SEO | | jasonwdexter
                            0
                          • android_lyon

                            303 redirect

                            Hi, 303 redirect is a good thing or not ? I have a homepage in 2 languages FR and EN > mywebsite.com/fr/ and mywebsite.com/en/. A 303 redirect is on mywebsite.com to mywebsite.com/fr/. Thanks D.

                            Intermediate & Advanced SEO | | android_lyon
                            0
                          • BrianAlpert78

                            Can I make 301 redirects on a Windows server (without access to IIS)?

                            Hey everyone, I've been trying to figure out a way to set up some 301 redirects to handle the broken links left behind after a site restructuring, but I can only ever find information on 2 methods that I can't use (as far as I can tell). The first method is to do some stuff with an htaccess file, but that looks like it only works on Linux-based servers. The method described for Windows servers is generally to install this IIS rewrite/redirect module and run that, but I don't think our web hosting company allows users to log directly into the server, so I wouldn't be able to use the IIS thing. Is there any other way to get a 301 redirect set up? And is this uncommon for a web hosting company to do, or do you all just run your sites on Linux-based servers or your own Windows machines? Thanks!

                            Intermediate & Advanced SEO | | BrianAlpert78
                            0
                          • Prime85

                            301 Redirect - What happens to backlinks

                            Hello... One of my sites is losing rankings in G. I received the webmaster notification of unnatural links... My question is, should i do a 301 redirect of every page on my site to a new domain? If so, do the backlinks (which i believe are causing my rankings to drop) carry over? How about the good backlinks? Also, what would happen to the rankings i currently have on page 1? Thanks

                            Intermediate & Advanced SEO | | Prime85
                            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.