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. Change name of directory

    Change name of directory

    Technical SEO Issues
    11 3 486
    • 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.
    • wellnesswooz
      wellnesswooz last edited by

      How can I best change the name of a directory on my website (example: http://www.website.com/**nameofdirectory**/)?

      The directory has lots of content included in it which has links from all over my website. I guess I have to adjust those links? How do I easily collect all of the links?

      Which is the code I should use in my htacces?

      Thank you!

      With kind regards,
      Dieter

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

        You need to add a 301 redirect to your new page. This will send a command to your browser (and any bots) to go to the new page. This page describes how to modify your htaccess file.

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

          @ Highland: It is not a page, it is a directory.

          Highland 1 Reply Last reply Reply Quote 0
          • NakulGoyal
            NakulGoyal last edited by

            Is your website static or uses some sort of a CMS ? It might be possible to do a search and replace for nameofdirectory or newnameofdirectory and that should work. I would also recommend doing a directory level 301 redirect via .htaccess that will redirect  http://www.website.com/**nameofdirectory**/* to http://www.website.com/**new****nameofdirectory**/*

            //301 Redirect Entire Directory RedirectMatch 301 /nameofdirectory(.*) /newnameofdirectory/$1

            wellnesswooz 1 Reply Last reply Reply Quote 0
            • Highland
              Highland @wellnesswooz last edited by

              The same principle applies to all rewrites. You can rewrite one page, an entire directory or even your whole site. htaccess is one of Apache's best features and that's why every web server out there offers some version of it.

              If I'm still not answering your question then please supply some more details and I can go more in depth.

              wellnesswooz Highland 2 Replies Last reply Reply Quote 1
              • wellnesswooz
                wellnesswooz @NakulGoyal last edited by

                The website itself is static but the directory is a CMS. What would be the best option then?

                NakulGoyal 1 Reply Last reply Reply Quote 0
                • wellnesswooz
                  wellnesswooz @Highland last edited by

                  I just dont see how I can add a 301 redirect to a page. I thought I could only add it in .htaccess?

                  How about the pages on my website that link to the old directory?

                  1 Reply Last reply Reply Quote 0
                  • NakulGoyal
                    NakulGoyal @wellnesswooz last edited by

                    Download the website and do a search and replace for nameofdirectory to new****nameofdirectory. That should take care of it. Along with that put a 301 in place for any external links going to nameofdirectory. You should be good.

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

                      Is there a software I should use for "Search & Replace"?

                      NakulGoyal 1 Reply Last reply Reply Quote 0
                      • NakulGoyal
                        NakulGoyal @wellnesswooz last edited by

                        You can use a text editor like Notepad++ for it.

                        1 Reply Last reply Reply Quote 0
                        • Highland
                          Highland @Highland last edited by

                          A 301 is the code returned by your web server, along with the address of the new page. htaccess (mod_rewrite) is the most powerful tool to do this because it uses regular expressions to filter (which, consequently, also makes it more difficult to use).

                          You don't have to use htaccess, however. Virtually all server-side programming languages (like PHP, .NET, Ruby on Rails, etc) support telling Apache what headers to return. Here's a PHP example

                          header("HTTP/1.1 301 Moved Permanently");
                          header("Location:http://www.newsite.com");
                          exit();

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post
                          • How to recover search volume after domain name change?
                            MonicaOConnor
                            MonicaOConnor
                            0
                            4
                            205

                          • Changing a domain name, pages redirection
                            EricaMcGillivray
                            EricaMcGillivray
                            0
                            12
                            124

                          • Change e-commerce platform and domain name SEO issue.
                            MoosaHemani
                            MoosaHemani
                            0
                            5
                            1.2k

                          • Changing Domain Name
                            rasmusbang
                            rasmusbang
                            0
                            4
                            190

                          • How should I organize my pages? Directory or no directory?
                            evolvingSEO
                            evolvingSEO
                            0
                            3
                            298

                          • Directory Naming & File Organization
                            AdamThompson
                            AdamThompson
                            0
                            2
                            236

                          • URL Folders and Naming Convention Changes?
                            Matthew_Edgar
                            Matthew_Edgar
                            0
                            2
                            354

                          • Change of domain name?
                            TheARKlady
                            TheARKlady
                            1
                            4
                            414

                          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