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
-
Is it worth keeping a decades-old domain that's merely 301 redirecting to the main domain?
Hi fellow Moz SEOs, We have a bigger client who we just did an SEO Site Audit for, and it was discovered that they have several domain names that are simply 301 redirecting to their main domain name. One of their domains in particular is decades old, and the client is asking if there is any value in keeping it (and the others), or simply leaving them as-is. Considering the domain age, does anyone have any recommendations? Much appreciated, Zack Barton
Intermediate & Advanced SEO | | Zack
Barton Interactive
(833) 442.6853 // office
(408) 910.7750 // mobile
https://bartoninteractive.com0 -
Flip-Flopping domains - 301 redirect question
We have a client who has had the following domain setup for some time: longdomain.com 301 -> shortdomain.com Now, they would like to go back to the original longdomain.com, and will have the following setup: shortdomain.com 301 -> longdomain.com Obviously, I'm concerned about redirect loops cached in the browser. I plan to have the 301's from longdomain.com changed over to 302's for two weeks ahead of the change, so that hopefully when the change happens, browsers and search engines are more ready to respond. I also plan to establish rel=canonical on the longdomain.com pages after the switch. Is there anything else you'd recommend to help with the changeover? Should we plan for an intermediary period were both domains are serving the content, so that the redirects can be purged, before being re-established the other direction? Thanks in advance.
Intermediate & Advanced SEO | | Bit-Wizards0 -
Can't understand our Ranking; DA, PA and On Page all better than Competiton; Ranking no where
Our rankings are up and down but our domain is clean, DA and PA good
Intermediate & Advanced SEO | | AlexSTUDIO18
and there is really in depth content which is all original. We are at a bit of a loss; The site is
http://www.fightstorepro.com I can use the phrase "Boxing Gloves" as an example
http://www.fightstorepro.com/gear/gloves/boxing-gloves.html PA 26 , DA29
Good original content; Video content, On page grade A
Not ranking in top 50 places?? The competitor in Pos4 is not matching our placing Anyone shed any light on this?0 -
Pagination and View All Pages Question. We currently don't have a canonical tag pointing to View all as I don't believe it's a good user experience so how best we deal with this.
Hello All, I have an eCommerce site and have implemented the use rel="prev" and rel="next" for Page Pagination. However, we also have a View All which shows all the products but we currently don't have a canonical tag pointing to this as I don't believe showing the user a page with shed loads of products on it is actually a good user experience so we havent done anything with this page. I have a sample url from one of our categories which may help - http://goo.gl/9LPDOZ This is obviously causing me duplication issues as well . Also , the main category pages has historically been the pages which ranks better as opposed to Page 2, Page 3 etc etc. I am wondering what I should do about the View All Page and has anyone else had this same issue and how did they deal with it. Do we just get rid of the View All even though Google says it prefers you to have it ? I also want to concentrate my link juice on the main category pages as opposed being diluted between all my paginated pages ? - Does anyone have any tips on how to best do this and have you seen any ranking improvement from this ? Any ideas greatly appreciated. thanks Peter
Intermediate & Advanced SEO | | PeteC120 -
.htaccess 301 Redirect Help! Specific Redirects and Blanket Rule
Hi there, I have the following domains: OLD DOMAIN: domain1.co.uk NEW DOMAIN: domain2.co.uk I need to create a .htaccess file that 301 redirects specific, individual pages on domain1.co.uk to domain2.co.uk I've searched for hours to try and find a solution, but I can't find anything that will do what I need. The pages on domain1.co.uk are all kinds of filenames and extensions, but they will be redirected to a Wordpress website that has a clean folder structure. Some example URL's to be redirected from the old website: http://www.domain1.co.uk/charitypage.php?charity=357 http://www.domain1.co.uk/adopt.php http://www.domain1.co.uk/register/?type=2 These will need to be redirected to the following URL types on the new domain: http://www.domain2.co.uk/charities/ http://www.domain2.co.uk/adopt/ http://www.domain2.co.uk/register/ I would also like a blanket/catch-all redirect from anything else on www.domain1.co.uk to the homepage of www.domain2.co.uk if there isn't a specific individual redirect in place. I'm literally tearing my hair out with this, so any help would be greatly appreciated! Thanks
Intermediate & Advanced SEO | | Townpages0 -
301 redirect via htaccess question
So, I have www.sitea.com and www.siteb.com I want to redirect SOME pages from www.sitea.com to www.siteb.com (example: www.sitea.com/plugins/wp/ to www.siteb/wp/ etc ) and the rest of any pages left, to the homepage of www.siteb.com. It is something with conditions... any help, please?
Intermediate & Advanced SEO | | jasmin280 -
What happens with a 301 redirected page?
Hi All, What happens with an indexed page that I 301 redirect?
Intermediate & Advanced SEO | | BeytzNet
Is it removed from the Google index after a while? Thanks0 -
Reducing pages with canonical & redirects
We have a site that has a ridiculous number of pages. Its a directory of service providers that is organized by city and sub-category of the vertical. Each provider is on the main city page, then when you click on a category, it will only show those folks who offer that subcategory of this service. example: colorado/denver - main city page colorado/denver/subcat1 - subcategory page There are 37 subcategories. So, 38 pages that essentially have the same content - minus a provider or two - for each city. There are approx 40K locations in our database. So rough math puts us at 1.5 million results pages, with 97% of those pages being duplicate content! This is clearly a problem. But many of these obscure pages do rank and get traffic. A fair amount when you aggregate all these pages together. We are about to go through a redesign and want to consolidate pages so we can reduce the dupe content, get crawl budget allocated to more meaningful pages, etc. Here's what I'm thinking we should do with this site, and I would love to have your input: Canonicalize Before the redesign use the canonical tag on all the sub-category pages and push all the value from those pages (colorado/denver/subcat1, /subcat2, /subcat3... etc) to the main city page (colorado/denver/subcat1) 301 Redirect On the new site (we're moving to a new CMS) we don't publish the duplicate sub-category pages and do 301 redirects from the sub-category URLs to the main city page urls. We'd still have the sub-categories (keywords) on-page and use some Javascript filtering to narrow results. We could cut to the chase and just do the redirects, but would like to use canonicalization as a proof of concept internally at my company that getting rid of these pages is a good thing, or at least wont have a negative impact on traffic. i.e. by the time we are ready to relaunch traffic and value has been transfered to the /state/city page Trying to create the right plan and build my argument. Any feedback you have will help.
Intermediate & Advanced SEO | | trentc0