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. .htaccess newby

    .htaccess newby

    Intermediate & Advanced SEO
    16 3 334
    • 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.
    • GlobalLingo
      GlobalLingo last edited by

      Sorry to ask a really dumb question. I want to sort out a load of old 404 errors. I've exported the list of URL and I'm more than happy to go through that and work out what needs to go where.

      After that my only option at the moment is to use the re-direct function in my WordPress install and do all the work manually. There are loads to do so I want to be able to upload all the re-directs.

      I know I need to create a htaccess file and upload it. I know where to upload it.

      This is where I get nervous. I need to get this file right. Is there a really obvious idiots file which I can use and then save as the correct file type? I've got all the URLs in a CSV at the moment.

      Sorry for being a bit thick. Hope you can help.

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

        Hey Richard

        This isn't a thick question at all - you're very wise to take care with this. A faulty .htaccess file can cause chaos!

        Just wanted to make a suggestion - if you're running WordPress have you tried the Redirection plugin? It does all of the rewriting for you - just pop in the old URL and the new URL and you're on your way.  Comes with a few other features too and has had tons of downloads over the years.

        If you want to go down the route of self-education, check out the SEOMoz redirection guide and also this blog post on some useful .htaccess snippets.

        I'd recommend using the redirection plugin for 2-3 urls, check it works then look at the generated .htaccess file in your website's backend.  From there, you can see the correct format and filetype etc.  If the tool works, just continue to use it.

        Hope this helps!

        1 Reply Last reply Reply Quote 2
        • GlobalLingo
          GlobalLingo last edited by

          Hi Tom,

          Thanks for the quick response. That's why I'm being very careful. I have used the re-direction tool but as there are quite a lot to do I was looking for some way to create one big file and then upload rather than copy and paste nearly 300 entries

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

            Hi Richard,

            Updating htaccess files can be tricky, especially with that risk of wrecking your site if you do something wrong. So, not a dumb question at all.

            WordPress is a great way to add redirects, but if you are dealing with hundreds that can equal a lot of time.

            So, if you are looking for a way to quickly build the htaccess file vs. doing everything manually in WordPress, my trick is use to a concatenation function in Excel. That way I can write hundreds of redirects at once and then copy the resulting text into the htaccess file.

            The general idea is you have your old URL path in col A, the new URL (full URL) in column B, and then in column C, you'd have a formula that looks something like this (obviously line numbers might change):

            ="redirect 301 " & A2 & " " & B2

            You could then copy column C and add that to your .htaccess file. Of course, back up the htacecss file first. The only word of caution would be to make sure you have valid paths in column A (no special characters, no full URLs, etc.).

            Hope that helps.

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

              Hi Matthew,

              That is the perfect answer, thank you so much. Just creating the file was where I was getting stuck and knowing what to put in the columns.

              what I have at the moment is:

              Column A = 404 url

              Column B = URL I want

              That solution is perfect, I'm more than happy using that!

              1 Reply Last reply Reply Quote 0
              • GlobalLingo
                GlobalLingo @Matthew_Edgar last edited by

                Hi Matthew,

                Sorry, pretty nervous now!

                Here's what I have in the columns

                A = http://www.global-lingo.com/news/2009/12/news-internet-translations/

                B = http://www.global-lingo.com/blog/

                C = redirect 301 http://www.global-lingo.com/news/2009/12/news-internet-translations/ http://www.global-lingo.com/blog/

                I think I got a little lost with the full URL in column A. What should I remove? Or have a got it correct? Sorry to use the real URL I just want to make sure I get this correct.

                Thanks

                Richard

                Matthew_Edgar 1 Reply Last reply Reply Quote 0
                • Matthew_Edgar
                  Matthew_Edgar @GlobalLingo last edited by

                  Hey Richard,

                  You are really close! 🙂 In column A, do a find for "http://www.global-lingo.com" and replace with nothing. That way you are left with:

                  A = /news/2009/12/news-internet-translations/

                  B = http://www.global-lingo.com/blog/

                  C = redirect 301 /news/2009/12/news-internet-translations/ http://www.global-lingo.com/blog/

                  Thanks,
                  Matthew

                  GlobalLingo 1 Reply Last reply Reply Quote 1
                  • GlobalLingo
                    GlobalLingo @Matthew_Edgar last edited by

                    Brilliant, thanks Matthew

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

                      Ok now I'm stuck again!

                      I have the list, in the right format, thanks to Matthew.

                      I can see where to upload the file, but now I'm worried that it will replace all my existing redirects. From the WordPress site I can't see where I can export all the existing redirects so that I could at least add my new ones to the existing ones and upload a new file.

                      Any ideas guys?

                      Matthew_Edgar 1 Reply Last reply Reply Quote 0
                      • Matthew_Edgar
                        Matthew_Edgar @GlobalLingo last edited by

                        Hey -

                        Glad you got everything in the right format!

                        Can you download your current .htaccess file via FTP? I'd download that and then add the new redirects at the bottom of the file and then upload the file. Be sure to save a backup of the htaccess file before you make changes.

                        Let me know if that works? Thanks,
                        Matthew

                        GlobalLingo 1 Reply Last reply Reply Quote 0
                        • GlobalLingo
                          GlobalLingo @Matthew_Edgar last edited by

                          That's what I want to do. But I can't be sure I have the right file. There are .htaccess files in a few folders

                          Thanks for bearing with me Matthew

                          Matthew_Edgar 1 Reply Last reply Reply Quote 0
                          • Matthew_Edgar
                            Matthew_Edgar @GlobalLingo last edited by

                            Ah, I see what you are saying. You want to download the one from the site root for redirects. Typically, that is going to be something like a /public_html or /httpdocs folder. Do you have an htaccess file there?

                            GlobalLingo 1 Reply Last reply Reply Quote 0
                            • GlobalLingo
                              GlobalLingo @Matthew_Edgar last edited by

                              Got one.

                              This is the content - not certain that's what I need?

                              redirect permanent /index.html http://www.global-lingo.com/index.php

                              BEGIN WordPress

                              <ifmodule mod_rewrite.c="">RewriteEngine On
                              RewriteBase /
                              RewriteRule ^index.php$ - [L]
                              RewriteCond %{REQUEST_FILENAME} !-f
                              RewriteCond %{REQUEST_FILENAME} !-d
                              RewriteRule . /index.php [L]</ifmodule>

                              END WordPress

                              Matthew_Edgar 1 Reply Last reply Reply Quote 0
                              • Matthew_Edgar
                                Matthew_Edgar @GlobalLingo last edited by

                                Yeah, that looks to be the right file. So, in this case, I'd put the new redirects right after the current redirect.

                                redirect permanent /index.html http://www.global-lingo.com/index.php

                                PUT NEW REDIRECTS HERE

                                BEGIN WordPress

                                Let me know if that works!

                                GlobalLingo 2 Replies Last reply Reply Quote 0
                                • GlobalLingo
                                  GlobalLingo @Matthew_Edgar last edited by

                                  Thanks for that.

                                  All done now, fingers crossed!

                                  Richard

                                  1 Reply Last reply Reply Quote 0
                                  • GlobalLingo
                                    GlobalLingo @Matthew_Edgar last edited by

                                    Tested and all working!

                                    1 Reply Last reply Reply Quote 0
                                    • 1 / 1
                                    • First post
                                      Last post
                                    • Htaccess maximum size?
                                      KevinBudzynski
                                      KevinBudzynski
                                      0
                                      2
                                      264

                                    • Quick htaccess question
                                      Modi
                                      Modi
                                      0
                                      3
                                      130

                                    • Help with htaccess
                                      Aleyda
                                      Aleyda
                                      0
                                      2
                                      85

                                    • .htaccess files
                                      JamesFx
                                      JamesFx
                                      0
                                      4
                                      294

                                    • Newbie Alert!
                                      snappyuk
                                      snappyuk
                                      0
                                      5
                                      332

                                    • .htaccess code ?
                                      Marcus_Miller
                                      Marcus_Miller
                                      0
                                      2
                                      485

                                    • Newbie to SEO and SEOMOZ help
                                      buntrosgali
                                      buntrosgali
                                      0
                                      6
                                      391

                                    • Htaccess funny characters
                                      Flapjack
                                      Flapjack
                                      0
                                      5
                                      836

                                    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