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. Redirecting special characters in .htaccess and web.config

    Redirecting special characters in .htaccess and web.config

    Technical SEO Issues
    7 4 10.6k
    • 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.
    • JamesBSEO
      JamesBSEO last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • ThompsonPaul
        ThompsonPaul last edited by

        In each of these cases, you are essentially writing regular expressions into your rewrite rules.

        Many not-alphabetic characters serve special functions in regex. In order to tell a regular expression to treat the special characters as actual characters and not to represent their special functions. you have to "escape" them - i.e. tell the system not to process them, but to treat as simple characters.

        You do this by adding a "****" (but without quotation marks) in front of each special character that needs to be treated as "normal".

        Redirect 301 /p/339/atmosphere-ipad... http://yourpoetic.com/p/339/atmosphere-ipad-mini-case

        In the other .htaccess example, you are dealing with a double-encoded space (%2520). Is that actually how the url appears? Or is that an artifact of having it pasted it into this question page?

        If that's how the URL actually needs to be written in the redirect, you would escape each of the special characters as above. You might also want to try writing the spaces in the origin URL as **%20 **then escape that, as it's the single-encoded version of a space.

        Lastly, if the URL should actually have a space in it (problematic), you need to replace the space with a the regex  character that represents a literal space - "\S" (Again no quotes) So:

        Redirect 301 /article-files/A\SQualitative\SAnalysis.pdf /http://ellenensher.com/article-files/A\SQualitative\SAnalysis.pdf

        Sorry for the multiple versions, but things will depend a bit on where the encoding is being introduced that you're showing in your URL examples.

        If not clear, holler.

        Paul

        P.S. If you have control over how those URLs are generated in the first place, they seriously need some cleaning up - those are a mess 🙂

        1 Reply Last reply Reply Quote 3
        • JamesBSEO
          JamesBSEO last edited by

          Thank you so much for this ThompsonPaul! I'll give these a shot first thing tomorrow morning and let you know how it turns out!

          And no, I don't have control over these urls, they're all inbound! 😄

          (I've been reduced to emailing webmasters to fix them all until now...)

          ThompsonPaul 1 Reply Last reply Reply Quote 0
          • ThompsonPaul
            ThompsonPaul @JamesBSEO last edited by

            Good luck, and do let me know how it works out. There's more fussing we can do, especially dealing with the spaces (the %2520 and %20) depending how their encoding is actually working.

            P.

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

              So sadly, I couldn't get these examples to work! 😞

              Any other tries would be greatly appreciated!

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

                Hi James,

                I've seen that you have asked a question about how to redirect those multiple URLs with special characters that you have identified in Google Webmaster Tools as giving errors.

                Before diving on how you can actually redirect them (which can be a bit tricky due to what Paul mentioned before about character encoding), I would like to ask you if these are "real" URLs that are showing (or were showing before) content on your site or are these URLs that never have existed and for some reason someone internally or externally linked at some point, or added to your sitemap (and this is how Google has arrived to them)? you can clicked on them in Google Webmaster Tools crawl errors report to get this information.

                I'm asking this since in dependence of your answer it might be reasonable or not to redirect them. I look forward for your confirmation.

                Thanks!

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

                  Just what I was looking for.  & Thank you Aleyda for the tip on checking to see that the url with escaped characters is really on the site. That reduced the # of redirects needed by 75%.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  • HTacess 301 redirect with special characters
                    abhigarapati
                    abhigarapati
                    0
                    2
                    132

                  • Redirection in .htaccess
                    Bharath_ATZ
                    Bharath_ATZ
                    0
                    5
                    91

                  • 301 redirects without .htaccess
                    NancyVPS
                    NancyVPS
                    0
                    5
                    2.0k

                  • Special characters in URL
                    customerparadigm.com
                    customerparadigm.com
                    0
                    3
                    4.0k

                  • 301 redirect .htaccess
                    Christy-Correll
                    Christy-Correll
                    0
                    5
                    234

                  • Special characters in URL
                    donford
                    donford
                    0
                    6
                    577

                  • HTACCESS redirect vs. forwarding
                    Highland
                    Highland
                    0
                    2
                    304

                  • 301 redirect .htaccess problem
                    sferrino
                    sferrino
                    0
                    4
                    709

                  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