Forum Moderators: phranque

Message Too Old, No Replies

Help with .htacess mod rewrite

latin characters error

         

fakestar

11:06 am on Jun 4, 2006 (gmt 0)

10+ Year Member



Hi, i need to change the .htacess of my script cause latin characters make errors

The part of .htacess i want to change:

RewriteEngine on
RewriteRule ^tshirt/([0-9]+)/([_A-Za-z0-9-]+).html index.php?action=file&fileid=$1 [L]

For example, if article name is "caça" with cedilha i get error, cause browser don't suport this kind of characters.

i want to make the .htacess change it to "caca".

The same with "mãe" i need to change to "mae"

How do i do this?
The complete characters i need to change:

ç to c
ã to a
ê, â, ô to e, a , o
á, é, í, ó, ú to a, e, i, o, u

thanks in advance.

jdMorgan

2:15 pm on Jun 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mod_rewrite is ill-suited to character conversion, unless you call it from httpd.conf and use RewriteMap to invoke a script to do the character-conversion.

You can make your existing .htaccess code accept UTF-encoded characters and pass them to your php script by changing the pattern, though:


RewriteEngine on
RewriteRule ^tshirt/([0-9]+)/([^.]+)\.html index.php?action=file&fileid=$1 [L]

This makes the second subpattern accept *any* characters except for a literal period, so it will match everything between the slash and the ".html".

Your script can then unencode the UTF-encoded characters, if desired.

Jim