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. Infinite Redirect Loop without trailing slash, please help

    Infinite Redirect Loop without trailing slash, please help

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

                  Yes as I said above 🙂

                  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

                      Hey Debora,

                      Any luck?

                      Keith

                      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
                        • 1 / 1
                        • First post
                          Last post
                        • How to enable lost trailing slash redirection in WordPress with Yoast plugin
                          Mobilio
                          Mobilio
                          0
                          2
                          765

                        • Should I switch from trailing slash to no trailing slash?
                          ThompsonPaul
                          ThompsonPaul
                          0
                          6
                          1.6k

                        • Trailing Slash and Non-Trailing Slash Inconsistency
                          nerdieb
                          nerdieb
                          0
                          3
                          412

                        • Transferring Domain and redirecting old site to new site and Having Issues - Please help
                          kwoolf
                          kwoolf
                          0
                          4
                          330

                        • New Site (redesign) Launched Without 301 Redirects to New Pages - Too Late to Add Redirects?
                          BeanstalkIM
                          BeanstalkIM
                          0
                          8
                          732

                        • To slash or not to slash - Going from no trailing slashes to trailing slashes sitewide
                          justin-brock
                          justin-brock
                          0
                          2
                          135

                        • .htaccess 301 Redirect Help! Specific Redirects and Blanket Rule
                          LynnPatchett
                          LynnPatchett
                          0
                          3
                          3.1k

                        • Does having a trailing slash make a url different than the same url without the trailing slash?
                          webestate
                          webestate
                          0
                          4
                          2.2k

                        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

                        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