: Can Apache .htaccess convert the percent-encoding in encoded URIs from Win-1252 to UTF-8? I want to add a directive in my .htaccess, such that if the browser is pointed at a URI containing
I want to add a directive in my .htaccess, such that if the browser is pointed at a URI containing %E4 (ä) - or any other special character - the .htaccess automatically rewrites %E4 (ä) as %C3%A4 (ä).
In summary, I want .htaccess to convert Win-1252 percent-encoding to UTF-8 percent-encoding.
I know I can do this by adding a series of mod_rewrite rules - but I was wondering if there is a native .htaccess directive that will take care of this.
====
This is as far as I've got on my own so far (I have many more entries in my .htaccess than in the list below, but I've abridged the list to äéîöü for example purposes):
RewriteRule ([^ä]*)ä([^ä]*ä[^/]*)(/[.*])? %C3%A4 [N]
RewriteRule ([^ä]*)ä([^ä]*)$ www.domain.com/%C3%A4 [NE,R=301]
RewriteRule ([^é]*)é([^é]*é[^/]*)(/[.*])? %C3%A9 [N]
RewriteRule ([^é]*)é([^é]*)$ www.domain.com/%C3%A9 [NE,R=301]
RewriteRule ([^î]*)î([^î]*î[^/]*)(/[.*])? %C3%AE [N]
RewriteRule ([^î]*)î([^î]*)$ www.domain.com/%C3%AE [NE,R=301]
RewriteRule ([^ö]*)ö([^ö]*ö[^/]*)(/[.*])? %C3%B6 [N]
RewriteRule ([^ö]*)ö([^ö]*)$ www.domain.com/%C3%B6 [NE,R=301]
RewriteRule ([^ü]*)ü([^ü]*ü[^/]*)(/[.*])? %C3%BC [N]
RewriteRule ([^ü]*)ü([^ü]*)$ www.domain.com/%C3%BC [NE,R=301]
Does anyone know:
1) How I can tidy this up?
2) It won't work if there is a more than one special character (single occurrence or multiple occurrences) in the URI. Is there any straightforward way to ensure the rules will handle multiple special characters?
More posts by @Alves908
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.