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. Hacked website - Dealing with 301 redirects and a large .htaccess file

    Hacked website - Dealing with 301 redirects and a large .htaccess file

    Intermediate & Advanced SEO
    6 5 374
    • 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.
    • FPK
      FPK last edited by

      One of my client's websites was recently hacked and I've been dealing with the after effects of it. The website is now clean of malware and I already appealed to Google about the malware issue. The current issue I have is dealing with the 20, 000+ crawl errors which are garbage links that were created from the hacking.

      How does one go about dealing with all the 301 redirects I need to create for all the 404 crawl errors? I'm already noticing an increased load time on the website due to having a rather large .htaccess file with a couple thousand 301 redirects done already which I fear will result in my client's website performance and SEO performance taking a hit as well.

      1 Reply Last reply Reply Quote 0
      • Linda-Vassily
        Linda-Vassily last edited by

        If they are garbage links, why are you redirecting them? Let them 404. Having not found pages does not lead to penalties, in and of itself.

        ChrisAshton 1 Reply Last reply Reply Quote 0
        • PenaltyHammer
          PenaltyHammer last edited by

          Hi

          I just finished similar job.

          What you should do:

          • collect all bad "pages" and links pointing to them
          • find a pattern like some kind of directory
          • set them (directories I believe?) 410, not 404
          • set robots to disallow those directories
          • push all pages and links to reindex
          • remove from Google index
          • done (need to wait some time)

          Important thing is to get rid of all bad links pointing to those pages. If you do that, then there'll be no issues. However this could be ongoing negseo. If you need help with that, pm me.

          Krzysztof

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

            Just a correction here.  I agree with all the items above, with one very, very, very, very, very important change.

            DO NOT set the corrected urls to disallow in your robots.txt

            If you do not allow Google to crawl the pages, Google will not see that the links were removed, that the page is now 4xx, etc. If you were to disallow all those pages, all the clean up work that you have done will not be seen by Google and would be for naught.

            If you later want to disallow those pages, that would be fine, but you need to let Google see your clean up work first.

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

              So robots part could be at the end but in my case it worked fine too.

              1 Reply Last reply Reply Quote 0
              • ChrisAshton
                ChrisAshton @Linda-Vassily last edited by

                This is the correct answer.

                To expand on this slightly, just make sure none of the 404s are internal (ie there are no links on your site pointing to one of these dodgy pages as a result of the hack) and you're all good.

                Remove the entries from your htaccess file to avoid having to parse them constantly and let any external links to dodgy pages 404. This sort of circumstance is exactly what 404s are made for!

                The only site at risk of a ranking drop from these 404s is the one pointing to those dodgy pages - who cares about your hackers' rankings? 🙂

                1 Reply Last reply Reply Quote 1
                • 1 / 1
                • First post
                  Last post
                • 301 Redirects for Multiple Language Sites in htaccess File
                  GFD_Chris
                  GFD_Chris
                  0
                  2
                  120

                • Mass 301 redirect in htaccess
                  moon-boots
                  moon-boots
                  0
                  4
                  100

                • How long should I keep the 301 redirect file
                  4RS_John
                  4RS_John
                  0
                  9
                  322

                • 301 Redirect from now defunct website?
                  BCME
                  BCME
                  0
                  5
                  352

                • 301 Redirect To Another 301 Redirect
                  cbielich
                  cbielich
                  0
                  5
                  247

                • DNS or 301 Website Redirect
                  Cyrus-Shepard
                  Cyrus-Shepard
                  0
                  5
                  3.9k

                • Splitting one Website into 2 Different New Websites with 301 redirects, help?
                  AdamThompson
                  AdamThompson
                  0
                  5
                  3.5k

                • Why isnt my crawl results showing a 301 redirect even though I have a 301 rewrite in my .htaccess file?
                  PCTechGuy2012
                  PCTechGuy2012
                  0
                  8
                  462

                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