tags:

views:

31

answers:

3

Hi, in .htaccess imposibla use space, non-Latin characters and etc. ? For example how, fix this:

RewriteRule ^/(.*)/new user/(.*)$ /page/?id=$1 [QSA,L,E]

this decision is not me:

... /new_user/ ...

Thanks

+1  A: 

You have to escape the reserved characters for URIs with their respective character codes in percent-encoding, e. g. %20 for a space.

See http://en.wikipedia.org/wiki/Percent-encoding for more details.

joschi
I see that you're only providing an example, but last time I checked, a space was an ASCII character =)
mkoistinen
Granted. I've corrected the answer. ;)
joschi
A: 

OK .. signs allowed in url: http://www.blooberry.com/indexdot/html/topics/urlencoding.htm and in htaccess:

RewriteRule ^(([0-9]+)-)?new_user(-([0-9]+))?/?$   new_user.php?page=$2&id=$4 [L] 

change www.blabla.com/10-new_user-5
to www.blabla.com/new_user.php?page=10&id=5

jatt
A: 

The URL is automatically decoded before your rules operate on it, so you can test against literal characters, e.g. français\ español (note that you need to escape literal spaces with a backslash, unless the pattern is quoted).

However, based on your example, I think your actual concern is being able to do something like this:

RewriteRule ^([^/]+)/[^/]+/.*$ /page/?id=$1 [QSA,L]
#                    ^---^
#                       it doesn't matter what the user name is, as long as it
#                       doesn't contain a slash
Tim Stone