URL percent encoding is not working

末鹿安然 提交于 2019-12-11 07:07:50

问题


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?


回答1:


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 


来源:https://stackoverflow.com/questions/4988127/htaccess-mode-rewrite-match-percent-symbol-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!