Redirecting special characters in .htaccess and web.config
-
This post is deleted! -
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

-
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...)
-
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.
-
So sadly, I couldn't get these examples to work!

Any other tries would be greatly appreciated!
-
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!
-
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%.