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. Technical SEO Issues
    4. Kill your htaccess file, take the risk to learn a little

    Kill your htaccess file, take the risk to learn a little

    Technical SEO Issues
    2 2 373
    • 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.
    • cbielich
      cbielich last edited by

      Last week I was browsing Google's index with "site:www.mydomain.com and wanted to scan over to see what Google had indexed with my site. I came across a URL that was mistakenly indexed. It went something like this

      www.mydomain.com/link1/link2/link1/link4/link3

      I didn't understand why Google had indexed a page like that of mine when the "link" pages were links that were on my main bar which were site wide links. It seemed to be looping infinitely over and over. So I started trying to see how many of these Google had indexed and I came across about 20 pages. I went through the process of removing the URL's in Webmaster Tools, but then I wanted to know why it was happening. I had discovered that I had mistakenly placed some links on my site in my header in such a manner

      link1

      link2

      link3

      If you know HTML you will realize that by not placing the "/" in the front of the link I was telling that page to add that link in addition to the URL that is was currently on. What this did was create an infinite loop of links which is not good 🙂

      Basically when Google went to www.mydomain.com/link1/ it found the other links which then told Google to add that url to the existing URL and then go to that link.

      Something like: www.mydomain.com/links1/link2/...

      When you do not add the "/" in front of the directory you are linking too it will do this. The "/" refers to the root so if you place that in front of your directory you are linking too it will always assume that first "/" as the root then the url will follow.

      So what did I do?

      Even though I was able to find about 20 URL's using the "site:" search method there had to be more out there. Even though I tried to search I was not able to find anymore, but I was not convinced.

      The light bulb went on at this point

      My .htaccess file contained many 301 redirects in my attempt to try and redirect those pages to a real page, they were not really relevant pages to redirect too. So how could I really find out what Google had indexed out there for me since Webmaster Tools only reports the top 1000 links.

      I decided to kill my htaccess file. Knowing that Google is "forgiving" when major changes to your site happen I knew Google would not simply just kill my site for removing my htaccess file immediately.

      I waited 3 days then BOOM! Webmaster Tools was reporting to me that it found a ton of 401's on my site. I looked at the Crawl Errors and there they were. All those infinite loop links that I knew had to be more out there, I was able to see.

      How many were there?

      Google found in the first crawl over 5,000 of them. OMG! Yeah could you imagine the "Low quality" score I was getting on those pages? By seeing all those links I was able to determine about 4 patterns in the links. For example:

      www.mydomain.com/link1/link2/

      www.mydomain.com/link1/link3/

      www.mydomain.com/link1/link4/

      www.mydomain.com/link1/link5/

      Now my issue was I wanted to keep all the URL's that were pointing to www.mydomain.com/link1 but anything after that I needed gone. I went into my Robots.txt file and added this

      Disallow: www.mydomain.com/link1/link2/

      Disallow: www.mydomain.com/link1/link3/

      Disallow: www.mydomain.com/link1/link4/

      Disallow: www.mydomain.com/link1/link5/

      Now there were many more pages indexed that went deeper into those links but I knew I wanted anything after the 2nd URL gone since it was the start of the loop that I detected. With that I was able to have from what I know at least 5k links if not more.

      What did I learn from this?

      Kill your htaccess file for a few days and see what comes back in your reports. You might learn something 🙂

      After doing this I simply replaced my htaccess file and I am on my way to removing a ton of "low quality" links I didn't even know I had.

      1 Reply Last reply Reply Quote 0
      • KevinBudzynski
        KevinBudzynski last edited by

        Interesting post. Yeah, the .htaccess file is the most important file out there and it is easy to mess up (as I am sure most everyone has at one time or another).

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        • Where to put 301 redirects in my Wordpress htaccess file?
          Benspain
          Benspain
          0
          3
          34

        • Help creating a 301 redirect in my htaccess file
          Felip3
          Felip3
          0
          4
          108

        • Looking for a tool that will display the contents of the htaccess file
          MikeTek
          MikeTek
          0
          3
          77

        • How should I properly setup my .htaccess file?
          maxduveen
          maxduveen
          0
          5
          2.0k

        • Broken links shall i put them in my htaccess file to generate juice
          ClaireH-184886
          ClaireH-184886
          0
          4
          434

        • Need Help writing 301 redirects in .htaccess file
          Dr-Pete
          Dr-Pete
          0
          5
          1.3k

        • Help needed please with 301 redirects in htaccess file.
          petersommertravels
          petersommertravels
          0
          9
          2.3k

        • How long does it take for customized Google Site Search to show results from pdf files?
          Lauroca
          Lauroca
          0
          10
          3.1k

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