法国字符重写规则法国、重写、字符、规则

2023-09-02 11:28:00 作者:木木酱

我在我的数据库类的名字,以及一些主题有法国的人物,如E E E。 它可以根据需要,直到今天,当我试图添加其他字符到它,然后我开始SERVER ERROR

I have categories name in my database, and some of theme have french characters like é è ê. It works as desired until today when I tried to add another character à to it then I started getting SERVER ERROR

下面是我的.htaccess:

Here is my .htaccess:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([A-Za-z0-9éèêà_-s]+)-(d+).htm$   classified.php?id=$2 [L]

正如你所看到的,它工作正常,而不单。

As you can see, it works fine without the à.

我如何添加东西进入正则表达式?

How do I add that thing into the regex ?

推荐答案

如果您正在使用的所有排序的字符和重音字母的,那么为什么不只是让什么去了?

If you are using all sort of characters and accented letters, then why don't just allow anything to go by?

注:使用本规则也将使空间;

NOTE: Using this Rule will also allow spaces;

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)-(d+).htm$   classified.php?id=$2 [L]

和以后,如果你决定限制正则表达式,可以说你不想要这些字符#$%,那么你必须做出例外:

And later if you decide to limit the regex, lets say you don't want any of these characters # $ % then you have to make exceptions:

   Options +FollowSymlinks
  RewriteEngine on
  RewriteRule ^([^#$%]+)-(d+).htm$   classified.php?id=$2 [L]