• majorAlexa

        See all notifications

        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
          • MozCon
          • Webinars, Whitepapers, & Guides
        • Blog
        • Why Moz
          • Digital Marketers
          • Agency Solutions
          • Enterprise Solutions
          • Small Business Solutions
          • 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.

          Let your business shine with Listings AI
          Moz Local

          Let your business shine with Listings AI

          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
          • Digital Marketers

            Simplify SEO tasks to save time and grow your traffic.

          • 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.

          • 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
        • 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. 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
        3840
        Loading More Posts
        • Watching

          Notify me of new replies.
          Show question in unread.

        • Not Watching

          Do not notify me of new replies.
          Show question in unread if category is not ignored.

        • Ignoring

          Do not notify me of new replies.
          Do not show question in unread.

        • Oldest to Newest
        • Newest to Oldest
        • Most Votes
        Reply
        • Reply as question
        Locked
        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

                              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

                              • Davit1985

                                My url disappeared from Google but Search Console shows indexed. This url has been indexed for more than a year. Please help!

                                Super weird problem that I can't solve for last 5 hours. One of my urls: https://www.dcacar.com/lax-car-service.html Has been indexed for more than a year and also has an AMP version, few hours ago I realized that it had disappeared from serps. We were ranking on page 1 for several key terms. When I perform a search "site:dcacar.com " the url is no where to be found  on all 5 pages. But when I check my Google Console it shows as indexed I requested to index again but nothing changed. All other 50 or so urls are not effected at all, this is the only url that has gone missing can someone solve this mystery for me please. Thanks a lot in advance.

                                Intermediate & Advanced SEO | | Davit1985
                                0
                              • Easigrass

                                Help with force redirect HTTP to HTTPS

                                Hi, I'm unsure of where I should be putting the following code for one of my Wordpress websites so that they redirect all HTTP requests to HTTPS. RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] This is my current htaccess file: *missing

                                Intermediate & Advanced SEO | | Easigrass
                                0
                              • NeatIT

                                6 .htaccess Rewrites: Remove index.html, Remove .html, Force non-www, Force Trailing Slash

                                i've to give some information about my website Environment 1. i have static webpage in the root. 2. Wordpress installed in sub-dictionary www.domain.com/blog/ 3. I have two .htaccess , one in the root and one in the wordpress
                                folder. i want to www to non on all URLs Remove index.html from url Remove all .html extension / Re-direct 301 to url
                                without .html extension Add trailing slash to the static webpages / Re-direct 301 from non-trailing slash Force trailing slash to the Wordpress Webpages / Re-direct 301 from non-trailing slash Some examples domain.tld/index.html >> domain.tld/ domain.tld/file.html >> domain.tld/file/ domain.tld/file.html/ >> domain.tld/file/ domain.tld/wordpress/post-name >> domain.tld/wordpress/post-name/ My code in ROOT htaccess is <ifmodule mod_rewrite.c="">Options +FollowSymLinks -MultiViews RewriteEngine On
                                RewriteBase / #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://domain.com/ [R=301,L]
                                RewriteCond %{THE_REQUEST} .html
                                RewriteRule ^(.*).html$ /$1 [R=301,L]</ifmodule> The above code do 1. redirect www to non-www
                                2. Remove trailing slash at the end (if exists)
                                3. Remove index.html
                                4. Remove all .html
                                5. Redirect 301 to filename but doesn't add trailing slash at the end

                                Intermediate & Advanced SEO | | NeatIT
                                0
                              • Stew222

                                Too many 301 redirects?

                                Hey, My company currently has one chief website with about 500-600 other domains that all feature the same material as the chief website.  These domains have been around for about 5 years and have actually picked up some link traffic. I have all of these identical web-pages utilizing rel=canonical but I was wondering if I would be better served, from SEO purposes, to 301 redirect all of these sites to their respective pages on our chief website?  If I add 500 301 redirects, will the major search engines consider this to be black-hat link-building even though the sites are related and technically already feature the same content? For an example, the chief website is www.1099pro.com and I would 301 redirect the below sites to the chief site: 1099softwarepro.com 1099softwarepro.info 1099softwarepro.net 1099softwarepro.biz 1099softwareprofessionals.com 1099softwareprofessionals.info ...you get the point

                                Intermediate & Advanced SEO | | Stew222
                                0
                              • Townpages

                                .htaccess 301 Redirect Help! Specific Redirects and Blanket Rule

                                Hi there, I have the following domains: OLD DOMAIN: domain1.co.uk NEW DOMAIN: domain2.co.uk I need to create a .htaccess file that 301 redirects specific, individual pages on domain1.co.uk to domain2.co.uk I've searched for hours to try and find a solution, but I can't find anything that will do what I need. The pages on domain1.co.uk are all kinds of filenames and extensions, but they will be redirected to a Wordpress website that has a clean folder structure. Some example URL's to be redirected from the old website: http://www.domain1.co.uk/charitypage.php?charity=357 http://www.domain1.co.uk/adopt.php http://www.domain1.co.uk/register/?type=2 These will need to be redirected to the following URL types on the new domain: http://www.domain2.co.uk/charities/ http://www.domain2.co.uk/adopt/ http://www.domain2.co.uk/register/ I would also like a blanket/catch-all redirect from anything else on www.domain1.co.uk to the homepage of www.domain2.co.uk if there isn't a specific individual redirect in place. I'm literally tearing my hair out with this, so any help would be greatly appreciated! Thanks

                                Intermediate & Advanced SEO | | Townpages
                                0
                              • bloomnation

                                DNS or 301 Website Redirect

                                We are running a marketplace site, so we have thousands of vendors selling their products on our site. Each vendor has a Profile page and we are soon to launch a premium store-front that is white label. Many of these vendors will want to point a custom url to their premium store-front (which is a sub domain of the marketplace) and we are trying to get an understanding of how we should instruct them to point their url in a way that will give the main marketplace site the seo juice. We also want to understand what will show up in the address bar.  Will it be their url or our sub domain? Will any of the marketplace seo juice boost their url local listing status?

                                Intermediate & Advanced SEO | | bloomnation
                                0
                              • MaartenvandenBos

                                Google penguin penalty(s), please help

                                Hi MozFans, I have got a question out of the field about www.coloringpagesabc.com.
                                Question is why the rankings and traffic are going down down down the last 4 months. Costumer thinks he got hit by google penguin update(s). The site has about 600 page’s/posts al ‘optimized’ for old seo:
                                - Almost all posts are superb optimized for one keyword combination (like … coloring pages) there is a high keyword density on the keyword titles and descriptions are all the same like: <keyword>and this is the rest of my title, This is my description <keyword>and i like it internal linking is all with a ‘perfect’  keyword anchor text there is a ok backlink profile, not much links to inner pages
                                -  there are social signals the content quality is low The site to me looks like a seo over optimized content farm Competition:
                                When I look at the competition. The most coloring pages websites don’t offer a lot of content (text) on there page. The offer a small text and the coloring pages (What it is about :-)) How to get the rankings back:
                                What I was thinking to do. rewrite the content to a smaller text. Low keyword density on the keyword and put the coloring pages up front. rewrite all titles and descriptions to unique titles and descriptions Make some internal links to related posts with a other anchor text. get linkbuilding going on inner pages get more social signals Am I on the right track? I can use some advise what to do, and where to start. Thanks!!</keyword></keyword> Maarten

                                Intermediate & Advanced SEO | | MaartenvandenBos
                                0
                              • lhc67

                                Keyword-Rich Domains - Redirect?

                                Hi, Mozzers- I have a client that has a bunch of pretty nice keyword-rich domain names. Their traffic and rankings are good. They provide legal services in the Chicago area. I have lots of good content that I could use to start a blog using a domain like keyword,keyword-blog.com. Good idea? Currently I have a resources area on their website but feel like this area could be getting a little bloated and some news-related stuff isn't really appropriate. 2 Questions: Should I use one of the decent domains for a blog and build up the rankings, traffic, and link to the main site?  Or is this lots of work for little payout? Both sites would be hosted in the cloud. Some of the domain names are related to their name, others are keyword or geo-targeted. Would it be wise to setup 301 redirects going to their website? Pros/cons? If you need additional info, please PM me for details. Thank you, friends! LHC

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