Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite & unicode characters

         

onemarc

12:55 am on Jun 17, 2005 (gmt 0)

10+ Year Member



Hello,

Could anybody tell me how to collect [unicode links?]

I would like to know how to rewrite url
http://example.com/wiki/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1
%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0

to something like this
http://example.com/index.php?url=wiki/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1
%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0

I tried to realize this, but I can only do it without unicode string, I can do something like this:
http://example.com/wiki/string1/string2/string3
to something like this
http://example.com/index.php?url=wiki/string1/string2/string3

RewriteRule ^([-/_\w\s]*)$ /index.php?url=$1 [L]

Have anybody got resolution, have anybody seen how it is done in wiki htaccess or similar pages, how to handle unicode urls?

Thank you

[edited by: jdMorgan at 2:55 am (utc) on June 17, 2005]
[edit reason] Removed specifics, fixed side-scroll. [/edit]

jdMorgan

2:51 am on Jun 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As I posted in your previous thread [webmasterworld.com], the technique discussed in this recent thread [webmasterworld.com], specifically in message #10 can be used to delete or modify %-encoded strings directly.

# Delete all after percent sign (This does not work)
RewriteRule ^([^%]+)\% http://www.example.com/$1 [R=301,L]
#
# Delete all after percent sign (This works)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^%]+)\%
RewriteRule .* http://www.example.com/%1 [R=301,L]

Jim

onemarc

4:53 am on Jun 17, 2005 (gmt 0)

10+ Year Member



Sorry Jim, don't work for me, i don't want to catch only one formula with %, i would like to catch everything after [test.com...] and put it in PHP $url variable

it could be [test.com...]
it could be [test.com...]
it could be [test.com...]
.......................

and i would like to get
$url=%D70
$url=%C99%2
$url=%E12%3/%D70
...............................

One

jdMorgan

5:02 am on Jun 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The code posted above does not do exactly what you want, but it demonstrates how to access the %-encoded characters using RewriteCond and server variable %{THE_REQUEST}. You can modify that code to suit your needs. If you attempt to modify it and it does not work, we'll be happy to answer specific questions, but we cannot write your code for you -- Please see our forum charter for more information.

Jim