301 doesn't redirect a page that ends in %20, and others being appended with ?q=
-
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.
-
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.
-
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]
-
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-pagecreates
www.site.com/new-page?q=old-pageI have tried the 301s both before the CMS rule and after it, without success.
-
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?
-
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.
-
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...
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
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.
Related Questions
-
301 redirects Ruby on Rails
Can anyone point me to the best way to implement 301 redirects on a Ruby on Rails website?
Intermediate & Advanced SEO | | brianvest0 -
Reversing the bad effects of a problematic 301 redirect
I have a previously very strong ranking page that is now omitted from the SERPs, but only for one specific keyword phrase. I think I found the reason, which I'll explain, and I hope I can hear some confirmation of my theory and a way to correct it. Let's use the following made up domain and keywords: Political blog SiteA.com had a few news articles about "Blue Widgets" (like 10 out of 10,000 pages). They became exceedingly popular, so on SiteA.com we created a reference-type page about "Blue Widgets" and in the news articles we already had about Blue Widgets we added rich anchor text (Blue Widgets) links that pointed to this new About Blue Widgets page. (long before we wised up about keyword rich anchor texts and Google!) After seeing how much traffic was coming to the About Blue Widgets page, we created a whole new site, SiteB.com, which was about Widgets (not just Blue Widgets), a page for each color of widget, and other pages about widgets. SiteB.com has an important and popular page, SiteB.com/blue-widgets, which is about Blue Widgets. We then 301 redirected the SiteA.com's About Blue Widgets page to SiteB.com/blue-widgets. This page in SiteB.com ranked very high (like #2, #3) for years. Two weeks ago SiteB.com/blue-widgets fell out of the SERPs, but only for the phrase "Blue Widgets". The page still gets lots of traffic from other queries, and even the "Blue Widgets" query will bring up other pages on SiteB.com. So, the only thing hit is the specific query "Blue Widgets" for the specific page SiteB.com/blue-widgets. It seems obvious to me that Google took the combination of a) a site that it probably no longer liked since we sold it (SiteA.com) since it's gone downhill, b) the rich keyword anchor text on SiteA.com pages pointing to the SiteA.com page optimized for that keyword, and c) then being 301 Redirected to a SiteB.com Blue Widgets page optimized for that same anchor text. I only discovered the SiteA.com redirects last week, which I had completely forgotten about, and had them removed right away. My question is, 1) if this indeed was the issue, now that the redirects from SiteA.com to SiteB.com are gone will my ranking eventually go back to normal? and 2) is there anything I can do to get Google to notice the change and have it go back to how it was?
Intermediate & Advanced SEO | | bizzer0 -
Is it a problem to use a 301 redirect to a 404 error page, instead of serving directly a 404 page?
We are building URLs dynamically with apache rewrite.
Intermediate & Advanced SEO | | lcourse
When we detect that an URL is matching some valid patterns, we serve a script which then may detect that the combination of parameters in the URL does not exist. If this happens we produce a 301 redirect to another URL which serves a 404 error page, So my doubt is the following: Do I have to worry about not serving directly an 404, but redirecting (301) to a 404 page? Will this lead to the erroneous original URL staying longer in the google index than if I would serve directly a 404? Some context. It is a site with about 200.000 web pages and we have currently 90.000 404 errors reported in webmaster tools (even though only 600 detected last month).0 -
Php 301 redirect
Hi I am migrating an old wordpress site to a custom PHP site and the URL profiles will be different, so want to retain all link profiles and more importantly if a user visits the old urls via search then they are seamlessly transferred to the new equivalent page For example www.domain.com/about-us is going to need to redirect to www.domain.com/aboutus.php www.domain.com/furniture is going to need to redirect to www.domain.com/furniture-collections.php etc What is the best way of achieving this apart from .htaccess as not 100% confident of doing this. Could it be done via PHP or using meta tags?
Intermediate & Advanced SEO | | ocelot0 -
Redirecting a redirect - thoughts?
Hi! A client has just had 14k 404s pop up in his WMT. I think this is because a page that they redirected to had moved. My question is, can I clean these up by redirecting the page the original redirect was one? If so, will it have any negative impact?
Intermediate & Advanced SEO | | neooptic0 -
How do you find all of your 301 redirects?
I would like a full list of 301 redirects that we have on our site. Is there a way to export it? I tried Bing Webmaster tools and the list was incomplete. We use IIS. Any ideas?
Intermediate & Advanced SEO | | EcommerceSite0 -
Effect of 301 redirect to a relative url to homepage?
One of our new clients recently encountered a site-wide ranking drop for many keywords and I'm pretty confident regarding their link profile as to being 98% legit. Background: 1. Client full site is https, and all http pages are 301 redirected to their https counterpart 2. Client has ~50 links partners (all legitimate sites + schools etc) links to client with urls such as www.example.com/portal/123.aspx that redirects to www.example.com. 3. Client homepage 301 redirects from www.example.com to www.example.com/default.aspx and then 301 redirects to the relative url "/Home.aspx". 4. Client launched some testing with Google website optimizer tool. ~1-2 months ago. Symptoms: 1. Rankings dropped for basically many/all 30-40+ keywords by ~15 positions 2. Seomoz reports close to a double of existing pages + (600+) duplicate content in the same date range. Webmasters only report 80 duplicate titles though. 3. Domain authority by seomoz reduced a bit + backlinks recorded by seomoz to the website nearly halved in the past 2 months. I'm not sure if I narrowed this towards the right direction, and it isn't clear when the relative url 301 redirect was implemented: 1. The 301 redirect to the relative page (www.example.com/default.aspx to "/home.aspx") is accounting for the loss of links recorded by seomoz. 2. The ~50 links the client currently use (www.example.com/portal.123.aspx 301 redirecting to www.example.com, also relative) as a tracking tool is being considered 301 redirect abuse. 3. Maybe something went wrong with the usage of google optimizer tool for SEO purposes? Visitor traffic to each of the tested pages looked fine. I would greatly appreciate any advice/insights on what I might be missing in terms of direction / factors. Thanks! Alex
Intermediate & Advanced SEO | | sixspokemedia0 -
Setting up of 301 redirects
Good morning all, As part of the analysis of our website, we have realised that we are diluting our keyword strength in a particular area by having multiple zones all targeting the same keyword. We have decided to combine these zones into one, and set up 301 redirects so that the remaining zone gets the benefit of the other zones' link juice. When setting up a 301 redirect from zone "X" to zone "Y" say, do I need to keep all of the content in zone X, or should I remove all content before the redirect is set up? Does zone Y still get the benefit of zone X's link juice if the content is removed? Many thanks Guy
Intermediate & Advanced SEO | | Horizon0