2

I'm trying to do a somewhat simple thing with no luck - I want to display Hebrew/Arabic characters in my URL.

For example: I want the URL to display a file named: aאm.php

So I've percent encoded the middle UTF8 characters and the result is: a%D7%90m.php. I've uploaded a%D7%90m.php to my server (Apache) and tried to request the pages www.example.com/a%D7%90m.php & www.example.com/aאm.php but my server responded:

The requested URL /a%D7%90m.php was not found on this server.

So I tried to upload aאm.php (without the percent encoding) instead, but again no luck when browsing www.example.com/a%D7%90m.php & www.example.com/aאm.php.

How to fix this issue?

Andrew T.
  • 4,701
  • 8
  • 43
  • 62
Tom
  • 9,275
  • 25
  • 89
  • 147
  • 1
    One trick worth trying might be activating a `DirectoryIndex` and seeing what URLs Apache itself serves on that page – Pekka Feb 11 '11 at 00:05
  • Thanks Pekka. it sees a%25D7%2590m.php (a 25 number was added to every percent) why is that? how can i fix this? – Tom Feb 11 '11 at 00:08
  • `%25` is the hex escape for `%`. This means you've use the escaped name for the filename. You need to create the file with the real character in its name. – Marcelo Cantos Feb 11 '11 at 00:19
  • Alright but when i do that, apache sees the page as "aàm.php" not "aאm.php" and even when i try to enter it i get "Not Acceptable" – Tom Feb 11 '11 at 00:24

1 Answers1

0

The solution was to set a mod rewrite the .htaccess in www.example.com. For example, if you want your link to be www.example.com/عربية and file www.example.com/arabic.php to actually handle the request behind the scenes, then simply write this code in the .htaccess file:

RewriteEngine 
OnRewriteRule ^عربية$ arabic.php 
Andrew T.
  • 4,701
  • 8
  • 43
  • 62
Tom
  • 9,275
  • 25
  • 89
  • 147
  • 1
    The question was "URL percent encoding is not working". Hardcoding a specific rewrite rule is not a proper answer for other users looking for the same answer to this issue. – David Vartanian Mar 16 '16 at 11:04