本文介绍了htaccess的规则efficent方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一大堆改写在我的.htaccess文件中的规则了。这背后的原因是有我的服务器处理后面的文件arabic.php当最终用户浏览到www.mysite.co.uk/~~Vعربية场景:

So i have a bunch of ReWrite rules up in my .htaccess file.The reason behind this is to have my server handle the file arabic.php behindthe scenes when an end user browse to www.mysite.co.uk/عربية :

RewriteEngine On
RewriteRule ^عربية$ arabic.php

我有一个像上面提到的一个约40规则。这个好与Apache还是我推,有一个更好的方式来实现我的最终目标?

i have about 40 rules like the one mentioned above. Is this "Okay" with apache or am i pushing it and there's a better way to achieve my end goal?

推荐答案

没有,它的罚款,就像任何其他的40规则,因为它使用常规EX pressions只是字符串比较。

No, it’s fine like having any other 40 rules as it’s only string comparison using regular expressions.

但你需要使用正确的字符编码​​,充其量UTF-8作为这对非ASCII字符preferred字符编码。你的情况的路径 /عربية实际上可能是连接codeD为 /%D8%B9%D8%B1%D8%A8%D9 %8A%D8%A9 这是文本的百分比恩codeD形式عربية当EN codeD的UTF-8

But you need to use a proper character encoding, at best UTF-8 as that’s the preferred character encoding for non-ASCII characters. In your case the path /عربية might actually be encoded as /%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9 that is percent-encoded form of the text عربية when encoded in UTF-8.

但也可能情况下的浏览器不使用UTF-8,但不同的编码。或者是因为浏览器使用不同的字符编码​​为URL或因为有人跟着,使用不同的字符在网页上的链接编码除UTF-8并没有采用正确的百分号编码像普通使用时:

But there also might be cases where the browser does not use UTF-8 but a different encoding. Either because the browser uses a different character encoding for the URL or because someone followed a link on a web page that uses a different character encoding other than UTF-8 and did not use proper percent-encoding like when used in plain:

<a href="http://example.com/عربية">

在这种情况下,عربية为en $ C $光盘的文件使用相同的字符编码​​。

In that case عربية is encoded with the same character encoding as the document uses.

这篇关于htaccess的规则efficent方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 11:43