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. Can someone interpret this entry in my htaccess file into english so that I can understand?

    Can someone interpret this entry in my htaccess file into english so that I can understand?

    Technical SEO Issues
    17 5 199
    • 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.
    • WilliamKammer
      WilliamKammer last edited by

      Alright... just give me a day or two since you don't have me on retainer 😉

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

        You got it.  🙂

        Again, thank you so much for taking a look.

        1 Reply Last reply Reply Quote 0
        • WilliamKammer
          WilliamKammer @Travis_Bailey last edited by

          Escaping characters isn't a big deal with newer version of Apache. No need for all those slashes, unless it's something more complex. From what I've seen, at least.

          Travis_Bailey 1 Reply Last reply Reply Quote 0
          • Travis_Bailey
            Travis_Bailey @WilliamKammer last edited by

            Would like to hear the resolution, given my endorsement.

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

              Hi,

              That line of htaccess says:

              If the host is legacytravel.com OR www.legacytravel.com, then lets try this rule below.

              One conditions will always be true since the htaccess is on your site. So they cancel each other out, and are not needed.

              The rule says if the URI matches the regular expression '^carrollton-travel-agent$' then redirect (r=301) to the target URL and stop processing rules (L flag for last)

              Your RewriteRule target doesn't need characters escaping because it is not a regular expression, just a URL to redirect to. You also don't need the quotes, they're useful for grouping arguments with spaces in them but that's not affecting it.

              Really this rewriterule doesn't accomplish anything, it redirects /carrollton-travel-agent to /carrollton-travel-agent, forcing the www. no matter which version is accessed. But if that is what you're wishing to achieve then there's a much simpler solution:

              RewriteCond %{HTTP_HOST} !^www.legacytravel.com$ [NC]

              RewriteRule ^(.*)$ http://www.legacytravel.com/$1 [R=301,L]

              Notice we only use the \backslash to escape characters in regex patterns, and not in our target URL. What that rule will do is redirect any visitor where the host is missing the www to the equivalent page with the preceding www.

              Hope that helps.

              Travis_Bailey 1 Reply Last reply Reply Quote 1
              • Travis_Bailey
                Travis_Bailey @TomVolpe last edited by

                It doesn't force www in any instance. That's why I'm looking forward to the solution.

                WilliamKammer 1 Reply Last reply Reply Quote 0
                • WilliamKammer
                  WilliamKammer @Travis_Bailey last edited by

                  Sorry to disappoint, Travis. Nothing too complicated, looks like it was just a botched www cleanup. A good old:

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

                  Will do the trick.

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

                    Alright, so if I take out all of the other nonsense...and just put this in...will that just make it go from legacytravel.com to www.legacytravel.com?

                    and that's that?

                    WilliamKammer 1 Reply Last reply Reply Quote 0
                    • WilliamKammer
                      WilliamKammer @cathibanks last edited by

                      Yep. Of course, as with any change, back the old rules up into a text file before making the move... just in case it explodes everything (but it won't). Just a precaution.

                      cathibanks 1 Reply Last reply Reply Quote 0
                      • cathibanks
                        cathibanks @WilliamKammer last edited by

                        Hello, my old htaccess buddy!

                        Let's say, perhaps, that a person wanted to change her main company blog from www.legacytravel.com/ramblings to www.legacytravel.com/blog.

                        Of course, all of the traffic would need to be re-directed.  the htaccess currently says:

                        BEGIN WordPress

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

                        END WordPress

                        Would it be appropriate / effective to add something there that directs everything in light of the renaming of that subfolder?

                        Again, thank you in advance.

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        • Set Up htaccess File
                          GFD_Chris
                          GFD_Chris
                          0
                          2
                          48

                        • Can someone evaluate this page so I can continue adding others?
                          RyanPurkey
                          RyanPurkey
                          0
                          6
                          100

                        • Can you help me understand leveraging semantic markup
                          ClaireH-184886
                          ClaireH-184886
                          0
                          3
                          271

                        • How can I find my Webmaster Tools HTML file?
                          healthgrades
                          healthgrades
                          0
                          5
                          309

                        • Kill your htaccess file, take the risk to learn a little
                          KevinBudzynski
                          KevinBudzynski
                          0
                          2
                          373

                        • How should I properly setup my .htaccess file?
                          maxduveen
                          maxduveen
                          0
                          5
                          2.0k

                        • Htaccess file
                          DMGoo
                          DMGoo
                          0
                          5
                          437

                        • Converting files from .html to .php or editing .htaccess file
                          donford
                          donford
                          0
                          11
                          3.6k

                        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