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.
    • 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

                              • Htaccess redirect veriables
                                NoisyLittleMonkey
                                NoisyLittleMonkey
                                0
                                3
                                96

                              • Htaccess 301 regex question
                                BlueprintMarketing
                                BlueprintMarketing
                                0
                                6
                                173

                              • Help with htaccess
                                Aleyda
                                Aleyda
                                0
                                2
                                85

                              • ASPX Newbie
                                SCW
                                SCW
                                0
                                3
                                87

                              • Modify .htaccess
                                Highland
                                Highland
                                0
                                10
                                466

                              • 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