Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have case where some adobe pdf files format the hyphen character as %E2%80%90. See http://forums.adobe.com/message/2807241 this is caused by the Calibri font I guess.

So these pdf files have been released and the links don't work So I thought mod rewrite would come to the rescue.

I followed this post here mod_ReWrite to remove part of a URL but I can't seem to search for the % characters according to this question.

Is there anything else I can do?

Here is the rewrite rule I want to use:

RewriteRule ^foo%(.+)bar  /foo-bar [L,R=301]

I also tried this and it doesn't work

RewriteRule ^foo%E2%80%90bar  /foo-bar [L,R=301]

Any Ideas?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Using the answer from this question, I was able to come up with this .htaccess rule which fixed my own unicode-hyphen-links-in-pdfs problem:

# for janky pdfs with links using unicode hyphens
RewriteRule ^([^_]*)\x25E2\x2580\x2590([^_]*_.*) $1-$2 [N]
RewriteRule ^([^_]*)\x25E2\x2580\x2590([^_]*)$ /$1-$2 [L,R=301]
share|improve this answer
add comment

From the docs:

... it is applied to the (%-decoded) URL-path of the request ...

So use the actual character in a UTF-8-encoded file instead.

share|improve this answer
    
Is there any way for it to see the difference between foo%E2%80%90bar and foo-bar? If not I might be out of luck. –  ChickenFur May 30 '12 at 16:43
    
... But you're looking for foo‐bar... –  Ignacio Vazquez-Abrams May 30 '12 at 16:53
    
example.com/foo%E2%80%90bar comes up with a page not found error. while example.com/foo-bar works fine. I guess I could just move the page to foo-bar-v1 and then redirect all foo-bar to foo-bar-v1. –  ChickenFur May 30 '12 at 17:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.