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 Redirect and Loss of PA and DA
Mozzers, http:itsgr82bme.com Old domain homepage had a DA of 24 and a PA of 36 Currently redirected to http://thekidstime.com Homepage shows a DA of 6 and a PA of 1. That is a significant loss of authority. I thought a 301 is supposed to be better than that. What gives? What are the next steps, asking the old backlinks to update their links? Thanks for your help, Matt
Intermediate & Advanced SEO | | matt.nails0 -
B2B site targeting 20,000 companies with 20,000 dedicated "target company pages" on own website.
An energy company I'm working with has decided to target 20,000 odd companies on their own b2b website, by producing a new dedicated page per target company on their website - each page including unique copy and a sales proposition (20,000 odd new pages to optimize! Yikes!). I've never come across such an approach before... what might be the SEO pitfalls (other than that's a helluva number of pages to optimize!). Any thoughts would be very welcome.
Intermediate & Advanced SEO | | McTaggart0 -
I've seen and heard alot about city-specific landing pages for businesses with multiple locations, but what about city-specific landing pages for cities nearby that you aren't actually located in? Is it ok to create landing pages for nearby cities?
I asked here https://www.google.com/moderator/#7/e=adbf4 but figured out ask the Moz Community also! Is it actually best practice to create landing pages for nearby cities if you don't have an actual address there? Even if your target customers are there? For example, If I am in Miami, but have a lot of customers who come from nearby cities like Fort Lauderdale is it okay to create those LP's? I've heard this described as best practice, but I'm beginning to question whether Google sees it that way.
Intermediate & Advanced SEO | | RickyShockley2 -
Does Google make continued attempts to crawl an old page one it has followed a 301 to the new page?
I am curious about this for a couple of reasons. We have all dealt with a site who switched platforms and didn't plan properly and now have 1,000's of crawl errors. Many of the developers I have talked to have stated very clearly that the HTacccess file should not be used for 1,000's of singe redirects. I figured If I only needed them in their temporarily it wouldn't be an issue. I am curious if once Google follows a 301 from an old page to a new page, will they stop crawling the old page?
Intermediate & Advanced SEO | | RossFruin0 -
Cannot 301 redirect, alternatives?
Hi, the company has changed it's name so now under a different domain. All pages have been 301 redirected on a 1:1 basis apart from the home page. For some reason IT cannot 301 redirect the old home page to the new website home page. At suggestions? Perhaps canonical it? Meantime the old home page copy has been changed to say the company name has changed and a link to the new website. Any help greatly appreciated.
Intermediate & Advanced SEO | | Richard5550 -
Do my redirects on my homepage need to be 301?
Our domain name is something like www.I-am-cool.com but most people just type in iamcool.com After doing some research I found that those are 302 redirects and I think they should be 301. If I am correct do I need to redirect www.iamcool.com and iamcool.com or just one or the other?
Intermediate & Advanced SEO | | EcommerceSite0 -
301 redirect and improved ranking
I was wondering if a 301 redirect will improve my ranking. My subpages use to redirect to my homepage ( all the subpages of my site redirecting to my homepage) and my homepage use to have no redirect from non www.to www. ( other than thru google webmaster tools. I am sure why it was like this for my subpages... I was wondering if I can expect some improvements in ranking now that the redirect goes from the none www. to the www version of each subpage and not to the homepage. By the way what was the issue ( was I telling google ) by re-directing all my subpages to the homepage ? was I making google think that my subpages and my homepage were all the same ? was I sending all the link juice from the subpages to my homepage ? etc... Thank you,
Intermediate & Advanced SEO | | seoanalytics0 -
Should you replace the url on a damaged page and 301 to it ?
Hi, We have a couple of pages which have been damaged due to an SEO person we hired creating a stupid amount of bookmarks and generally poor links. I've tried to get the links removed where I can but on most of these blogging sites there is no contact webmaster etc so I am struggling. Panda update as also affected traffic by about 35%. My question is , should I consider creating new urls for the "damaged " pages and then doing 301 redirects to them from the damaged page to the new page. Then start to build up good links to the new page whilst google should de-index the old pages over a couple of months ?. Just at my witts end how to get rid of these blogging rubbish etc etc. Thanks Sarah.
Intermediate & Advanced SEO | | SarahCollins0