URL%的编码不工作 [英] URL percent encoding is not working

查看:132
本文介绍了URL%的编码不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个稍微简单的事情,没有运气 - 我想在我的网址显示希伯来文/阿拉伯文字符

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

例如:我想要的网址显示一个文件名为: Aאm.php

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

所以我一直%的EN codeD中间UTF8字符,其结果是: A%D7%90m.php 。我已经上传 A%D7%90m.php 来我的服务器(Apache),并试图要求的网页www.example.com/a%D7%90m.php和放大器; www.example.com/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:

所请求的网址 /a%D7%90m.php 在此服务器上找到。

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

于是,我就上传 Aאm.php (不含%的编码)来代替,但同样没有浏览www.example.com/a%D7%90m时运气。 PHP和放大器; www.example.com/aאm.php。

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.

如何解决这个问题?

推荐答案

解决的办法是建立一个mod-rewrite的.htaccess 在www.example.com。例如,如果 你希望你的链接被www.example.com/~~Vعربية和文件www.example.com/arabic.php实际处理幕后的要求,后来干脆写code。在。 htaccess的文件:

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 

这篇关于URL%的编码不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆