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. On-Page / Site Optimization
    4. How do I fix a 404 with a 301

    How do I fix a 404 with a 301

    On-Page / Site Optimization
    6 6 1.2k
    • 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.
    • BenRWoodard
      BenRWoodard last edited by

      I understand the need for fixing 404's but I have yet to have a serious walkthrough of how to set up a 301.  From all the talk on the forums and such I'm pretty sure this is easy but I've just never done it before and I could really use a walk through.

      Thanks

      1 Reply Last reply Reply Quote 1
      • IM_Learner
        IM_Learner last edited by

        404 error is rendered when the resource requested is not found. You can do 2 things:

        • Implement 301 redirect to the new resource if it is related. The kind of redirect will depend upon the type of server your website is hosted on.
        • If 301 redirect is not possible on all the pages (it's understandable), a custom 404 page is a worthy option. It will avoid unnecessary loss of visitors from your site as they tend to get pissed with the default 404 page. It will not only help you retain the visitors but also redirect them to the important pages of your website. E.g.Custom 404 Page 

        Hope it helps.

        Regards

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

          I use .net when i build sites, iuse the Application_Error method to see if the error was a 404 tthen 301 to my home page. so any broken link 301 to my home page

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

            Hi Ben,

            You probably want to redirect a single page if it is going to a 404. In which case you probably just want add code into the header of the problem page. Whilst you are at it, it might be worth checking that your non-www. pages are forwarding to the www versions. (http://exampledomain.com -> http://www.exampledomain.com)

            PHP Redirect

            Header( "HTTP/1.1 301 Moved Permanently" ); 
            Header( "Location: http://www.exampledomain.com" ); 
            ?>

            Htaccess 301 Redirect (non-www. to www.)

            Options +FollowSymLinks RewriteEngine On
            RewriteBase / RewriteCond %{HTTP_HOST} !^www.exampledomain.com$ [NC] RewriteRule ^(.*)$ http://www.exampledomain.com/$1 [R=301,L]

            Custom 404 Page

            I would also suggest a custom 404 page with links to your most popular pages, search and a back button.

            Hope this helps.

            C

            1 Reply Last reply Reply Quote 1
            • Andy.Drinkwater
              Andy.Drinkwater last edited by

              You might find some additional help and code snippets here

              Regards,

              Andy

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

                Hi Ben,

                Did one of these responses answer your question for you? If not, also let us know if you're running anything like Wordpress or Drupal, and we can help give you more specific answers.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                • Best process for expired webinars advertised as events 301, 404
                  EricaMcGillivray
                  EricaMcGillivray
                  1
                  2
                  57

                • Inventory Pages that are Sold, 404 vs 301?
                  CleverPhD
                  CleverPhD
                  0
                  3
                  198

                • Over Optimization and how to fix it
                  TheWebMastercom
                  TheWebMastercom
                  0
                  5
                  140

                • How to Fix Google Webmasters Soft 404 Errors for Wordpress Site?
                  vmialik
                  vmialik
                  0
                  2
                  15.2k

                • How to do this 301 redirection
                  AndieF
                  AndieF
                  0
                  3
                  111

                • After Deletion of URL - Which is bettar 301 redirect or Error 404 Message.
                  NakulGoyal
                  NakulGoyal
                  0
                  6
                  394

                • 301 in place, still many 404 in GWT. Why?
                  gerardoH
                  gerardoH
                  0
                  5
                  453

                • My report indicated that I have 340 crawl warnings. Not sure how to fix them. Please provide links on where I need to go to fix them.
                  smstv
                  smstv
                  0
                  3
                  577

                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