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.

    • SEO Q&A

      Insights & discussions from an SEO community of 500,000+.

    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
3.8k
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 Sep 17, 2012, 6:35 PM

    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 Sep 25, 2012, 9:25 PM Sep 25, 2012, 9:25 PM

      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 Sep 19, 2012, 8:29 PM Sep 19, 2012, 8:29 PM

        Hey Debora,

        Any luck?

        Keith

        1 Reply Last reply Reply Quote 0
        • GeorgeAndrews
          GeorgeAndrews @debc last edited by Sep 18, 2012, 7:51 PM Sep 18, 2012, 7:51 PM

          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 Sep 18, 2012, 5:41 PM Sep 18, 2012, 5:41 PM

            Yes as I said above 🙂

            1 Reply Last reply Reply Quote 0
            • debc
              debc @debc last edited by Sep 18, 2012, 5:39 PM Sep 18, 2012, 5:39 PM

              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 Sep 18, 2012, 5:38 PM Sep 18, 2012, 5:38 PM

                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 Sep 18, 2012, 7:51 PM Reply Quote 0
                • SEOKeith
                  SEOKeith @debc last edited by Sep 18, 2012, 5:41 PM Sep 18, 2012, 5:36 PM

                  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 Sep 18, 2012, 5:07 PM Sep 18, 2012, 5:07 PM

                    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 Sep 25, 2012, 9:25 PM Reply Quote 0
                    • SEOKeith
                      SEOKeith last edited by Sep 17, 2012, 7:45 PM Sep 17, 2012, 7:45 PM

                      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 Sep 18, 2012, 5:07 PM Reply Quote 0
                      • GeorgeAndrews
                        GeorgeAndrews last edited by Sep 17, 2012, 8:23 PM Sep 17, 2012, 7:05 PM

                        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 Sep 18, 2012, 5:38 PM Reply Quote 0
                        • 1 / 1
                        1 out of 11
                        • First post
                          1/11
                          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

                        • ocelot

                          Php 301 redirect

                          Hi I am migrating an old wordpress site to a custom PHP site and the URL profiles will be different, so want to retain all link profiles and more importantly if a user visits the old urls via search then they are seamlessly transferred to the new equivalent page For example www.domain.com/about-us is going to need to redirect to www.domain.com/aboutus.php www.domain.com/furniture is going to need to redirect to www.domain.com/furniture-collections.php etc What is the best way of achieving this apart from .htaccess as not 100% confident of doing this.  Could it be done via PHP or using meta tags?

                          Intermediate & Advanced SEO | Jul 12, 2019, 11:17 AM | ocelot
                          0
                        • CommT

                          Should I redirect my xml sitemap?

                          Hi Mozzers, We have recently rebranded with a new company name, and of course this necessitated us to relaunch our entire website onto a new domain. I watched the Moz video on how they changed domain, copying what they did pretty much to the letter. (Thank you, Moz for sharing this with the community!) It has gone incredibly smoothly. I told all my bosses that we may see a 40% reduction in traffic / conversions in the short term. In the event (and its still very early days) we have in fact seen a 15% increase in traffic and our new website is converting better than before so an all-round success! I was just wondering if you thought I should redirect my XML sitemap as well? So far I haven't, but despite us doing the change of address thing in webmaster tools, I can see Google processed the old sitemap xml after we did the change of address etc. What do you think? I know we've been very lucky with the outcome of this rebrand but I don't want to rest on my laurels or get tripped up later down the line. Thanks everyone! Amelia

                          Intermediate & Advanced SEO | Apr 11, 2014, 1:01 PM | CommT
                          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 | Sep 16, 2013, 2:42 PM | Townpages
                          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 | Jun 4, 2013, 6:16 AM | android_lyon
                          0
                        • theLotter

                          302 redirects in the sitemap?

                          My website uses a prefix at the end to instruct the back-end about visitor details. The setup is similar to this site - http://sanfrancisco.giants.mlb.com/index.jsp?c_id=sf with a 302 redirect from the normal link to the one with additional info and a canonical tag on the actual URL without the extra info ((the normal one here being http://sanfrancisco.giants.mlb.com,) However, when I used www.xml-sitemaps.com to create a sitemap they did so using the URLs with the extra info on the links... what should I do to create a sitemap using the normal URLs (which are the ones I want to be promoting)

                          Intermediate & Advanced SEO | Jun 7, 2013, 10:46 AM | theLotter
                          0
                        • MyNet

                          How To 301 Redirect .html pages

                          I need to redirect a page/URL that is purely .html to a new location.  I don't know how to do this.  All the redirects I can find are for server side code pages .php/.aspx etc.  From my understanding I can't put a server side redirect in a .html file.  I am hosting on a microsoft server, however the new page I am redirecting to is .php.  I am running some WordPress (.php) files on the server.  I need to make it redirect before the old page loads so visitors don't start reading something that is about to get redirected Can someone please help me?

                          Intermediate & Advanced SEO | Oct 13, 2011, 9:32 PM | MyNet
                          0
                        • pbhatt

                          301 Redirects After Company Acquisition

                          We recently acquired a company, and now we are going to redirect all of the pages on their site to their respective pages on our site. Do we need to keep the original pages on their site active? For how long? Ideally, we would like to redirect everything and remove the old site entirely so we don't have to pay to keep hosting it. Is this possible? Thanks!

                          Intermediate & Advanced SEO | Oct 11, 2011, 7:23 PM | pbhatt
                          1
                        • seomasters

                          Cookies and redirects - what are the negative effects?

                          I am advising a client who wants to streamline their online customers experience through the use of cookies. The first time someone visits mysite.com, they will visit the normal index page, and on that page will be asked to identify themselves as a Personal or Business customer - and taken through to a relevant page. This will result in a cookie being added. The next time they come back to mysite.com, the cookie will automatically direct them from the index page to mysite.com/personal/ or mysite.com/business/. My question is, what are the SEO implications of this, especially given the fact the index page is their primary landing page for almost all organic traffic? Bots I realise that googlebot etc do not store cookies, so this should result in no change from the bots perspective (i.e. no redirect) but is it that simple? In effect we'll be showing the bot one thing and second time + visitors something else. Is this not effectively cloaking? All advice gratefully received!

                          Intermediate & Advanced SEO | Oct 5, 2011, 12:14 PM | seomasters
                          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.