undefined
Skip to content
Moz logo Menu open Menu close
  • Products
    • Moz Pro
    • Moz Pro Home
    • Moz Local
    • Moz Local Home
    • STAT
    • Moz API
    • Moz API Home
    • Compare SEO Products
    • Moz Data
  • Free SEO Tools
    • Domain Analysis
    • Keyword Explorer
    • Link Explorer
    • Competitive Research
    • MozBar
    • More Free SEO Tools
  • Learn SEO
    • Beginner's Guide to SEO
    • SEO Learning Center
    • Moz Academy
    • MozCon
    • Webinars, Whitepapers, & Guides
  • Blog
  • Why Moz
    • Digital Marketers
    • Agency Solutions
    • Enterprise Solutions
    • Small Business Solutions
    • The Moz Story
    • New Releases
  • Log in
  • Log out
  • Products
    • Moz Pro

      Your all-in-one suite of SEO essentials.

    • Moz Local

      Raise your local SEO visibility with complete local SEO management.

    • STAT

      SERP tracking and analytics for enterprise SEO experts.

    • Moz API

      Power your SEO with our index of over 44 trillion links.

    • Compare SEO Products

      See which Moz SEO solution best meets your business needs.

    • Moz Data

      Power your SEO strategy & AI models with custom data solutions.

    Let your business shine with Listings AI
    Moz Local

    Let your business shine with Listings AI

    Learn more
  • Free SEO Tools
    • Domain Analysis

      Get top competitive SEO metrics like DA, top pages and more.

    • Keyword Explorer

      Find traffic-driving keywords with our 1.25 billion+ keyword index.

    • Link Explorer

      Explore over 40 trillion links for powerful backlink data.

    • Competitive Research

      Uncover valuable insights on your organic search competitors.

    • MozBar

      See top SEO metrics for free as you browse the web.

    • More Free SEO Tools

      Explore all the free SEO tools Moz has to offer.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Learn SEO
    • Beginner's Guide to SEO

      The #1 most popular introduction to SEO, trusted by millions.

    • SEO Learning Center

      Broaden your knowledge with SEO resources for all skill levels.

    • On-Demand Webinars

      Learn modern SEO best practices from industry experts.

    • How-To Guides

      Step-by-step guides to search success from the authority on SEO.

    • Moz Academy

      Upskill and get certified with on-demand courses & certifications.

    • MozCon

      Save on Early Bird tickets and join us in London or New York City

    Unlock flexible pricing & new endpoints
    Moz API

    Unlock flexible pricing & new endpoints

    Find your plan
  • Blog
  • Why Moz
    • Digital Marketers

      Simplify SEO tasks to save time and grow your traffic.

    • Small Business Solutions

      Uncover insights to make smarter marketing decisions in less time.

    • Agency Solutions

      Earn & keep valuable clients with unparalleled data & insights.

    • Enterprise Solutions

      Gain a competitive edge in the ever-changing world of search.

    • The Moz Story

      Moz was the first & remains the most trusted SEO company.

    • New Releases

      Get the scoop on the latest and greatest from Moz.

    Surface actionable competitive intel
    New Feature

    Surface actionable competitive intel

    Learn More
  • Log in
    • Moz Pro
    • Moz Local
    • Moz Local Dashboard
    • Moz API
    • Moz API Dashboard
    • Moz Academy
  • Avatar
    • Moz Home
    • Notifications
    • Account & Billing
    • Manage Users
    • Community Profile
    • My Q&A
    • My Videos
    • Log Out

The Moz Q&A Forum

  • Forum
  • Questions
  • Users
  • Ask the Community

Welcome to the Q&A Forum

Browse the forum for helpful insights and fresh discussions about all things SEO.

  1. Home
  2. SEO Tactics
  3. Intermediate & Advanced SEO
  4. 301 doesn't redirect a page that ends in %20, and others being appended with ?q=

Moz Q&A is closed.

After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

301 doesn't redirect a page that ends in %20, and others being appended with ?q=

Intermediate & Advanced SEO
3
7
4.3k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as question
Log in to reply
This topic has been deleted. Only users with question management privileges can see it.
  • Brocberry
    Brocberry last edited by Oct 17, 2012, 4:06 PM

    I have a product page that ends /product-name**%20** that I'm trying to redirect in this way:

    Redirect 301 /products/product-name%20 http://www.site.com/products/product-name

    And it doesn't redirect at all. The others, those with %20, are being redirected to a url hybrid of old and new: http://www.site.com/products/product-name**?q=old-url**

    I'm using Drupal CMS, and it may be creating rules that counter my entries.

    1 Reply Last reply Reply Quote 0
    • PeterAttia
      PeterAttia last edited by Feb 5, 2013, 6:35 AM Feb 5, 2013, 6:35 AM

      I know this is an old thread, but I actually spotted this issue while trying to fix it myself. I was able to fix it by using quotes and a literal space. So for example, instead of

      RewriteRule ^/products/product%20name$ http://www.site.com/products/new-url [R=301,L]

      use

      RewriteRule "^/products/product name$" http://www.site.com/products/new-url [R=301,L]

      Hope that helps.

      1 Reply Last reply Reply Quote 0
      • topic:timeago_earlier,4 months
      • Brocberry
        Brocberry last edited by Oct 19, 2012, 8:02 AM Oct 19, 2012, 8:02 AM

        I've managed to 301 everything except that pesky %20 url, perhaps because of the %20 or perhaps because that's also the only one in a folder.

        Here's what's worked for simple urls such as www.site.com/old-page

        RewriteRule ^old-page$ http://www.site.com/new-page  [R=301,L]

        But the same format for the %20 hasn't worked:

        RewriteRule ^/products/product-name%20$ http://www.site.com/products/new-url [R=301,L]

        1 Reply Last reply Reply Quote 0
        • Brocberry
          Brocberry @Brocberry last edited by Oct 18, 2012, 11:13 AM Oct 18, 2012, 11:13 AM

          I think this is the culprit:

          Rewrite URLs of the form 'x' to the form 'index.php?q=x'.

          RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico 
          RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

          At the moment,
          Redirect 301 /old-page http://www.site.com/new-page

          creates
          www.site.com/new-page?q=old-page

          I have tried the 301s both before the CMS rule and after it, without success.

          1 Reply Last reply Reply Quote 0
          • StreamlineMetrics
            StreamlineMetrics @Brocberry last edited by Oct 17, 2012, 5:38 PM Oct 17, 2012, 5:38 PM

            Hmmm... I was going to also suggest trying replacing the %20 with an actual space -

            Redirect 301 "/products/product-name " http://www.site.com/products/product-name

            Now that you say none of the redirects are working as expected, did you try adding the 301 redirects above the Drupal rules in your .htaccess file? Can you paste the contents of your .htaccess?

            1 Reply Last reply Reply Quote 1
            • Brocberry
              Brocberry @StreamlineMetrics last edited by Oct 17, 2012, 5:19 PM Oct 17, 2012, 5:19 PM

              Thanks for the reply. I tried it but it didn't work, but I given incorrect info in the question, which is now corrected. I had said other 301 were working fine when in fact they weren't. Those without %20 are redirecting to an odd hybrid of urls.

              After some searching, I think this has something to do with the drupal CMS and the rules it creates in htaccess.

              StreamlineMetrics Brocberry 2 Replies Last reply Oct 18, 2012, 11:13 AM Reply Quote 0
              • StreamlineMetrics
                StreamlineMetrics last edited by Oct 17, 2012, 4:43 PM Oct 17, 2012, 4:42 PM

                Try putting it in quotes -

                Redirect 301 "/products/product-name%20" http://www.site.com/products/product-name

                Let me know if that doesn't work...

                Brocberry 1 Reply Last reply Oct 17, 2012, 5:19 PM Reply Quote 1
                • 1 / 1
                1 out of 7
                • First post
                  1/7
                  Last post

                Got a burning SEO question?

                Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


                Start my free trial


                Browse Questions

                Explore more categories

                • Moz Tools

                  Chat with the community about the Moz tools.

                • SEO Tactics

                  Discuss the SEO process with fellow marketers

                • Community

                  Discuss industry events, jobs, and news!

                • Digital Marketing

                  Chat about tactics outside of SEO

                • Research & Trends

                  Dive into research and trends in the search industry.

                • Support

                  Connect on product support and feature requests.

                • See all categories

                Related Questions

                • oceanstorm

                  301 Redirect in breadcrumb. How bad is it?

                  Hi all, How bad is it to have a link in the breadcrumb that 301 redirects? We had to create some hidden category pages in our ecommerce platform bigcommerce to create a display on our category pages in a certain format. Though whilst the category page was set to not visable in bigcommerce admin the URL still showed in the live site bread crumb. SO, we set a 301 redirect on it so it didnt produce a 404. However we have lost a lot of SEO ground the past few months.  could this be why? is it bad to have a 301 redirect in the breadrcrumb.

                  Intermediate & Advanced SEO | Jun 20, 2019, 7:32 AM | oceanstorm
                  0
                • dsbud

                  301 redirect hops from non-https and www

                  It's best practice to minimize the amount of 301 redirect hops. Ideally only one redirect hop. It's also best practice to 301 redirect (or at least canonical) your non-https and/or your non-www (or www) to the canonical protocol/subdomain. The simplest (and possibly the most common) way to implement canonical protocol/subdomain redirects is through a load balancer or before your app processes the request. Both of which will just blanket 301 to the canonical domain/protocol regardless if the path exists or not In which case, you could have: Two hops. i.e. hop #1 http://example.com/foo to https://example.com/foo, hop #2 https://example.com/foo to https://example.com/bar 301 to a 404. Let's say https://example.com/dog never existed, but somebody for whatever reason linked to it (maybe a typo). If I request https://www.example.com/dog, the load balancer would 301 to a 404 page. Either scenario above should be fairly rare. However, you can't control how people link to you. Should I care about either above scenario? I could have my app attempt to check if the page exists before forwarding, but that code could be complicated.

                  Intermediate & Advanced SEO | Oct 20, 2017, 1:26 AM | dsbud
                  0
                • Sandicliffe

                  301 Redirect Showing Up as Thousands Of Backlinks?

                  Hi Everyone, I'm currently doing quite a large back link audit on my company's website and there's one thing that's bugging me. Our website used to be split into two domains for separate areas of the business but since we have merged them together into one domain and have 301 redirected the old domain the the main one. But now, both GWT and Majestic are telling me that I've got 12,000 backlinks from that domain?  This domain didn't even have 12,000 pages when it was live and I only did specific 301 redirects (ie. for specific URL's and not an overall domain level 301 redirect) for about 50 of the URL's with all the rest being redirected to the homepage. Therefore I'm quite confused about why its showing up as so many backlinks - Old redirects I've done don't usually show as a backlink at all. UPDATE: I've got some more info on the specific back links. But now my question is - is having this many backlinks/redirects from a single domain going to be viewed negatively in Google's eyes? I'm currently doing a reconsideration request and would look to try and fix this issue if having so many backlinks from a single domain would be against Google's guidelines. Does anybody have any ideas? Probably somthing very obvious. Thanks! Sam

                  Intermediate & Advanced SEO | Apr 6, 2015, 6:40 PM | Sandicliffe
                  0
                • CayenneRed89

                  Help! The website ranks fine but one of my web pages simply won't rank on Google!!!

                  One of our web pages will not rank on Google.  The website as a whole ranks fine except just one section...We have tested and it looks fine...Google can crawl the page no problem.   There are no spurious redirects in place. The content is fine.  There is no duplicate page content issue.  The page has a dozen product images (photos) but the load time of the page is absolutely fine.  We have the submitted the page via webmaster and its fine.  It gets listed but then a few hours later disappears!!!  The site has not been penalised as we get good rankings with other pages.  Can anyone help?  Know about this problem?

                  Intermediate & Advanced SEO | Apr 9, 2015, 12:14 PM | CayenneRed89
                  0
                • Dillman

                  How do I get rel='canonical' to eliminate the trailing slash on my home page??

                  I have been searching high and low. Please help if you can, and thank you if you spend the time reading this. I think this issue may be affecting most pages. SUMMARY: I want to eliminate the trailing slash that is appended to my website. SPECIFIC ISSUE: I want www.threewaystoharems.com to showing up to users and search engines without the trailing slash but try as I might it shows up like www.threewaystoharems.com/ which is the canonical link. WHY?  and I'm concerned my back-links to the link without the trailing slash will not be recognized but most people are going to backlink me without a trailing slash. I don't want to loose linkjuice from the people and the search engines not being in consensus about what my page address is. THINGS I"VE TRIED: (1) I've gone in my wordpress settings under permalinks and tried to specify no trailing slash. I can do this here but not for the home page. (2) I've tried using the SEO by yoast to set the canonical page. This would work if I had a static front page, but my front page is of blog posts and so there is no advanced page settings to set the canonical tag. (3) I'd like to just find the source code of the home page, but because it is CSS, I don't know where to find the reference.  I have gone into the css files of my wordpress theme looking in header and index and everywhere else looking for a specification of what the canonical page is. I am not able to find it. I'm thinking it is actually specified in the .htaccess file. (4) Went into cpanel file manager looking for files that contain Canonical. I only found a file called canonical.php . the only thing that seemed like it was worth changing was changing line 139 from $redirect_url = home_url('/');  to $redirect_url = home_url('');       nothing happened. I'm thinking it is actually specified in the .htaccess file. (5) I have gone through the .htaccess file and put thes 4 lines at the top (didn't redirect or create the proper canonical link) and then at the bottom of the file  (also didn't redirect or create the proper canonical link) :   RewriteEngine on
                  RewriteCond %{HTTP_HOST} ^([a-z.]+)?threewaystoharems.com$ [NC]
                  RewriteCond %{HTTP_HOST} !^www. [NC]
                  RewriteRule .? http://www.%1threewaystoharems.com%{REQUEST_URI} [R=301,L] Please help friends.

                  Intermediate & Advanced SEO | Mar 16, 2014, 11:00 PM | Dillman
                  0
                • Stew222

                  Too many 301 redirects?

                  Hey, My company currently has one chief website with about 500-600 other domains that all feature the same material as the chief website.  These domains have been around for about 5 years and have actually picked up some link traffic. I have all of these identical web-pages utilizing rel=canonical but I was wondering if I would be better served, from SEO purposes, to 301 redirect all of these sites to their respective pages on our chief website?  If I add 500 301 redirects, will the major search engines consider this to be black-hat link-building even though the sites are related and technically already feature the same content? For an example, the chief website is www.1099pro.com and I would 301 redirect the below sites to the chief site: 1099softwarepro.com 1099softwarepro.info 1099softwarepro.net 1099softwarepro.biz 1099softwareprofessionals.com 1099softwareprofessionals.info ...you get the point

                  Intermediate & Advanced SEO | Nov 25, 2013, 7:18 PM | Stew222
                  0
                • robotseo

                  How to set up 301 redirect for URL with question mark

                  I have encountered some issue with 301 redirect and htaccess file. I need to redirect the following url: http://www.domain.com/?specifications=colours/page/3 to: http://www.domain.com/colours The 301 redirect command I wrote in htaccess file is as follow: Redirect 301 /?specifications=colours/page/3 http://www.domain.com/colours And it doesn't work at the moment. What is the correct way to set up 301 redirect here? Your help will be sincerely appreciated!

                  Intermediate & Advanced SEO | Feb 15, 2013, 12:46 PM | robotseo
                  0
                • Prime85

                  301 Redirect - What happens to backlinks

                  Hello... One of my sites is losing rankings in G. I received the webmaster notification of unnatural links... My question is, should i do a 301 redirect of every page on my site to a new domain? If so, do the backlinks (which i believe are causing my rankings to drop) carry over? How about the good backlinks? Also, what would happen to the rankings i currently have on page 1? Thanks

                  Intermediate & Advanced SEO | Nov 6, 2017, 1:07 PM | Prime85
                  0

                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
                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 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                • Accessibility
                • Terms of Use
                • Privacy

                Looks like your connection to Moz was lost, please wait while we try to reconnect.